Official TWRP Recovery Lands on Micromax Canvas Magnus

With the recent release of Android One, Micromax and MediaTek released fully buildable … more

Update Overload: SuperSU Heavily Updated

There are apps and apps out there. Very few can reach the level of popularity required to stay at … more

Lollipop Leak Available for the Sprint Galaxy S5

Since the Android 5.0Lollipop’s official release not too long ago, we’ve seen … more

CPU Spy Gets an Android Lollipop Makeover

At some point in the distant past, you probably heard of CPU Spy for Android by XDARetired … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[REF/DEV] KaiserGL SDK (for Imageon on Qualcomm 72xx devices)

OP NuShrike

8th August 2008, 01:29 AM   |  #1  
NuShrike's Avatar
OP Senior Recognized Developer
Thanks Meter: 10
 
1,035 posts
Join Date:Joined: Sep 2007
More
All REMOVED by user request.
Last edited by NuShrike; 3rd September 2009 at 08:25 PM. Reason: REMOVED by user request
8th August 2008, 01:32 AM   |  #2  
NuShrike's Avatar
OP Senior Recognized Developer
Thanks Meter: 10
 
1,035 posts
Join Date:Joined: Sep 2007
More
How-to
catch going to suspend: http://forum.xda-developers.com/show...41#post2776841
Last edited by NuShrike; 14th October 2008 at 10:02 PM.
8th August 2008, 01:33 AM   |  #3  
NuShrike's Avatar
OP Senior Recognized Developer
Thanks Meter: 10
 
1,035 posts
Join Date:Joined: Sep 2007
More
* more reserved *
8th August 2008, 08:31 PM   |  #4  
NuShrike's Avatar
OP Senior Recognized Developer
Thanks Meter: 10
 
1,035 posts
Join Date:Joined: Sep 2007
More
Following up from post getting OT in thread:
Quote:
Originally Posted by ycavan

My opengl es init function is called after UpdateWindow(), so I'm still stumped as to why the surface still cannot be created... here's my winmain:

You might be missing some of the modern WM6 calls. Here's the relevant code from the working ported version of Graphics for the Masses.

I started with working code from the AppWizard. tabs/spaces is pushing the formatting everywhere:

Code:
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
	MSG msg;
	HACCEL hAccelTable;
	int retval;

	// Perform application initialization:
	if (!InitInstance(hInstance, nCmdShow)) 
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_APPSTUFF));

	// Main message loop:
	for(;;)
	{
		switch(gMinimized_mode)
		{
		case 0:
game_loop:
			while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE)
			{
				if (GetMessage(&msg, NULL, 0, 0) )
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
					{
						TranslateMessage(&msg);
						DispatchMessageW(&msg);
					}
				}
				else
				{
					retval = (int) msg.wParam;
					goto out;
				}
			}

			if (!gMinimized_mode)
			{
				/* app code */
				eglSwapBuffers  (eglDisplay, eglWindowSurface);
				if(retval == 0)
				{
					/* app exit code */
					goto out;
				}
			}
			break;
		default:
			while (GetMessage(&msg, NULL, 0, 0) )
			{
				if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
				{
					TranslateMessage(&msg);
					DispatchMessageW(&msg);
				}
				if (msg.message == WM_PAINT)
				{
					gMinimized_mode = 0;
					goto game_loop;
				}
			}
			retval = (int) msg.wParam;
			goto out;
		}
	}
out:
	return retval;
}

ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass)
{
	WNDCLASS wc;

	wc.style         = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc   = WndProc;
	wc.cbClsExtra    = 0;
	wc.cbWndExtra    = 0;
	wc.hInstance     = hInstance;
	wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPSTUFF));
	wc.hCursor       = 0;
	wc.hbrBackground = NULL;//(HBRUSH) GetStockObject(WHITE_BRUSH);
	wc.lpszMenuName  = 0;
	wc.lpszClassName = szWindowClass;

	return RegisterClass(&wc);
}

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd;
    TCHAR szTitle[MAX_LOADSTRING];		// title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];	// main window class name

    g_hInst = hInstance; // Store instance handle in our global variable

    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the device specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

    //LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	wcscpy(szTitle, appName);
    LoadString(hInstance, IDC_OGLESEXFW, szWindowClass, MAX_LOADSTRING);

    //If it is already running, then focus on the window, and exit
    hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // set focus to foremost child window
        // The "| 0x00000001" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 

    if (!MyRegisterClass(hInstance, szWindowClass))
    {
    	return FALSE;
    }

    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

    if (!hWnd)
    {
        return FALSE;
    }

    // When the main window is created using CW_USEDEFAULT the height of the menubar (if one
    // is created is not taken into account). So we resize the window after creating it
    // if a menubar is present
    if (g_hWndMenuBar)
    {
        RECT rc;
        RECT rcMenuBar;

        GetWindowRect(hWnd, &rc);
        GetWindowRect(g_hWndMenuBar, &rcMenuBar);
        rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
		
        MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
    }


    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

	{
		/* EGL Setup */
		EGLContext ctx;
		EGLint majorVersion;
		EGLint minorVersion;

		//eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
		eglDisplay = eglGetDisplay(GetDC(hWnd));
		eglInitialize(eglDisplay, &majorVersion, &minorVersion);
		eglConfig = select_config(eglDisplay, EGL_WINDOW_BIT, 16, 16, 4); 
		ctx = eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
		eglWindowSurface = eglCreateWindowSurface(eglDisplay, eglConfig, hWnd, NULL);
		eglMakeCurrent(eglDisplay, eglWindowSurface, eglWindowSurface, ctx);
		/* rest of app init */
	}

    return TRUE;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int wmId, wmEvent;
    PAINTSTRUCT ps;
    HDC hdc;

    static SHACTIVATEINFO s_sai;
	
    switch (message) 
    {
        case WM_COMMAND:
            wmId    = LOWORD(wParam); 
            wmEvent = HIWORD(wParam); 
            // Parse the menu selections:
            switch (wmId)
            {
                case IDM_HELP_ABOUT:
                    DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About);
                    break;
                case IDM_OK:
                    SendMessage (hWnd, WM_CLOSE, 0, 0);				
                    break;
                default:
                    return DefWindowProc(hWnd, message, wParam, lParam);
            }
            break;
        case WM_CREATE:
			{
				SHMENUBARINFO mbi;

				memset(&mbi, 0, sizeof(SHMENUBARINFO));
				mbi.cbSize     = sizeof(SHMENUBARINFO);
				mbi.hwndParent = hWnd;
				mbi.nToolBarId = IDR_MENU;
				mbi.hInstRes   = g_hInst;

				if (!SHCreateMenuBar(&mbi)) 
				{
					g_hWndMenuBar = NULL;
				}
				else
				{
					g_hWndMenuBar = mbi.hwndMB;
				}

				// Initialize the shell activate info structure
				memset(&s_sai, 0, sizeof (s_sai));
				s_sai.cbSize = sizeof (s_sai);
			}
            break;
        case WM_PAINT:
            hdc = BeginPaint(hWnd, &ps);            
            // TODO: Add any drawing code here...            
            EndPaint(hWnd, &ps);
            if (!gMinimized_mode) eglSwapBuffer();
            break;
        case WM_DESTROY:
            eglMakeCurrent(NULL, NULL, NULL, NULL);
            eglDestroyContext(eglDisplay, eglContext);
            eglDestroySurface(eglDisplay, eglWindowSurface);
            eglTerminate(eglDisplay);

            CommandBar_Destroy(g_hWndMenuBar);
            PostQuitMessage(0);
            break;

		case WM_SIZE:
			switch(wParam)
			{
			case SIZE_MINIMIZED:
				gMinimized_mode = 1;
				break;
			case SIZE_MAXIMIZED: case SIZE_RESTORED: case SIZE_MAXSHOW:
				gMinimized_mode = 0;
			default:
				{
					RECT wrect;
					GetClientRect(hwnd, &wrect);
					/* app resize code */
					break;
				}
			}
			break;

        case WM_ACTIVATE:
            // Notify shell of our activate message
            SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
            break;
        case WM_SETTINGCHANGE:
            SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
            break;

        case WM_KEYDOWN:
        {
            switch(wParam)
            {
            case(VK_UP):
                break;
            case(VK_DOWN):
                break;
            case(VK_LEFT):
                break;
            case(VK_RIGHT):
                break;
            case(VK_RETURN):
                break;
            }
            if (wParam == VK_ESCAPE)
				SendMessage(hwnd, WM_CLOSE, 0, 0);
			break;
        }

        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
9th August 2008, 06:04 AM   |  #5  
Senior Member
Thanks Meter: 7
 
191 posts
Join Date:Joined: Nov 2007
I'm using evc4, so I can't build for a THUMB ( wince 5.0 ) device... any way you can recompile the lib for ARMv4?

Otherwise, I'm still linking w/ the Vincent lib.

Anyway, I started a whole new app ( appwizard hello template ) instead of writing the winmain from scratch and I still cannot generate a surface when I have anything but EGL_NONE in the config requests.

One thing I note is that fps is about 47-48, but once again, the texture is not mapped onto the object. If I put it in my folder w/ the Vincent dll, the texture is mapped and the fps is about 11-12.

I'm not quite familiar w/ EGL, but... does anyone know the EGLConfig structure? I tried searching for it to see what the requested width/height per config was so I can debug why the surface just doesn't get created.

anyway, here's my code:
TestApp2.zip
9th August 2008, 11:56 AM   |  #6  
NuShrike's Avatar
OP Senior Recognized Developer
Thanks Meter: 10
 
1,035 posts
Join Date:Joined: Sep 2007
More
Quote:
Originally Posted by ycavan

I'm using evc4, so I can't build for a THUMB ( wince 5.0 ) device... any way you can recompile the lib for ARMv4?

That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.

Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().

Also, Imageon may work better with GLfloat values although it probably kills Vincent (with software emulation on the ARM without native FP support in armv6 by the compiler) with anything but GLfixed. Try some benchmarking to see which works out better.
Last edited by NuShrike; 3rd September 2008 at 01:21 PM.
9th August 2008, 12:06 PM   |  #7  
raiisak's Avatar
Senior Member
Flag Oslo
Thanks Meter: 0
 
1,051 posts
Join Date:Joined: May 2008
More


100000xtimes thanks!
9th August 2008, 02:03 PM   |  #8  
Senior Member
Flag Vienna
Thanks Meter: 3
 
1,334 posts
Join Date:Joined: Mar 2007
More
can you make a sourceforce project??
9th August 2008, 04:32 PM   |  #9  
Senior Member
Thanks Meter: 7
 
191 posts
Join Date:Joined: Nov 2007
Quote:
Originally Posted by NuShrike

That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.

Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().
.

ARMv4 is what evc4 targets...
GetClientRect() is giving me very sane values, 268x240... 268 due to the bars up top & below.

I guess I'm just confused as to why Vincent is able to properly create the proper surface while our drivers cannot...

Edit:
Quote:

//eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglDisplay = eglGetDisplay(GetDC(hWnd));
eglInitialize(eglDisplay, &majorVersion, &minorVersion);
eglConfig = select_config(eglDisplay, EGL_WINDOW_BIT, 16, 16, 4);
ctx = eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
eglWindowSurface = eglCreateWindowSurface(eglDisplay, eglConfig, hWnd, NULL);
eglMakeCurrent(eglDisplay, eglWindowSurface, eglWindowSurface, ctx);
/* rest of app init */

I just realized that you don't provide egl config attribs for for eglCreateWindowSurface or for eglCreateContext... huh. Doing that, the surface and context are created ok, but the texture still isn't loaded... mebbe a problem w/ texture loading. :P
Last edited by ycavan; 9th August 2008 at 05:00 PM.
9th August 2008, 06:08 PM   |  #10  
Senior Member
Cypress, TX, USA
Thanks Meter: 12
 
263 posts
Join Date:Joined: Oct 2007
Donate to Me
More
Quote:
Originally Posted by NuShrike

That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.

Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().

Also, Imageon may with better with GLfloat values although it probably kills Vincent (with software emulation on the ARM without native FP support in armv6 by the compiler) with anything but GLfixed. Try some benchmarking to see which works out better.

In the words of the great Sammy L.
Quote:

ENGLISH MOTHAF*CKA DO YOU SPEAK IT!?!


Post Reply Subscribe to Thread

Tags
3d drivers, kaisergl, opengl
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes