Go Back   xda-developers > Development and hacking > Development and Hacking

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 8th August 2008, 01:29 AM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default [REF/DEV] KaiserGL SDK (for Imageon on Qualcomm 72xx devices)

All REMOVED by user request.
__________________
Support what I do and donate me a frankfurter.

Last edited by NuShrike; 3rd September 2009 at 08:25 PM.. Reason: REMOVED by user request
Reply With Quote
Sponsored Links

  #2  
Old 8th August 2008, 01:32 AM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default 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..
Reply With Quote

  #3  
Old 8th August 2008, 01:33 AM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default

* more reserved *
Reply With Quote

  #4  
Old 8th August 2008, 08:31 PM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default

Following up from post getting OT in thread:
Quote:
Originally Posted by ycavan View Post
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;
}
Reply With Quote

  #5  
Old 9th August 2008, 06:04 AM
ycavan ycavan is offline
Senior Member
 
Join Date: Nov 2007
Posts: 96
Default

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
Reply With Quote

  #6  
Old 9th August 2008, 11:56 AM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default

Quote:
Originally Posted by ycavan View Post
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..
Reply With Quote

  #7  
Old 19th August 2008, 11:14 PM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default

Links to GL optimization docs added. Docs also explain what a MSM7500 is and how the hardware works.

Please move/keep discussion of these docs into this thread.
Reply With Quote

  #8  
Old 30th August 2008, 04:00 PM
ycavan ycavan is offline
Senior Member
 
Join Date: Nov 2007
Posts: 96
Default

I'm about to pull my hair out on this one, guys... I'm trying to extend GAPI and one of the first things I'm trying to do is to rewrite the 2d graphics functions. I figured it'd be a no-brainer to create a pbuffer and render directly to that surface and use the pbuffer as the texture for a quad.

Well... eglChooseConfig chokes on EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE... and yet, our Kaiser's opengl es implementation has no problems calling glDrawTex[ifx]OES.

Render-to-Texture is supported in OGLES 1.1 and glDrawTex is also OGLES 1.1...

I'll upload my source later... I tried to add it as an attachment, but it failed.

...and if anyone is asking why I'm extending GAPI, it's just easier to rewrite. ...if we can do render-to-texture w/ the kaisers.
Reply With Quote

  #9  
Old 30th August 2008, 10:49 PM
NuShrike's Avatar
NuShrike NuShrike is offline
Senior Member
 
Join Date: Sep 2007
Posts: 864
Default

Quote:
Originally Posted by ycavan View Post
Render-to-Texture is supported in OGLES 1.1 and glDrawTex is also OGLES 1.1...
It is only OGLES 1.0 with selected 1.1 extensions. I don't think our implementation supports render to texture too well.

Try using Framebuffer objects instead.
Reply With Quote

  #10  
Old 2nd September 2008, 06:35 AM
ycavan ycavan is offline
Senior Member
 
Join Date: Nov 2007
Posts: 96
Default

Here's the code I'm currently working with: ngx.zip

Edit: I've scrapped Framebuffer and Pbuffer code and right now, just using updating the texture using glSubImageTex2D. For some reason, it's only updating 1 or 2 lines of the texture.

If you want to test it out, you can download GAPI Test:
http://www.adriansrojakpot.com/Speed...chmark_2.0.zip and place nGAPIBench.exe and ngx.dll in that folder.

All I've done is to hexedit the app to load ngx.dll, rather than gx.dll.

Last edited by ycavan; 3rd September 2008 at 06:12 AM..
Reply With Quote

Reply

Tags
3d drivers, kaisergl, opengl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:35 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.