Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,757 Members 47,077 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
NuShrike
Old
(Last edited by NuShrike; 3rd September 2009 at 07:25 PM.) Reason: REMOVED by user request
#1  
NuShrike's Avatar
Senior Recognized Developer - OP
Thanks Meter 10
Posts: 1,035
Join Date: Sep 2007
Default [REF/DEV] KaiserGL SDK (for Imageon on Qualcomm 72xx devices)

All REMOVED by user request.
active: HTC G2 -- B&N NookColor -- Nexus 7(2012) -- SG4 (M919 & GPE)
Support what I do and donate me a frankfurter.
 
NuShrike
Old
(Last edited by NuShrike; 14th October 2008 at 09:02 PM.)
#2  
NuShrike's Avatar
Senior Recognized Developer - OP
Thanks Meter 10
Posts: 1,035
Join Date: Sep 2007
Default How-to

catch going to suspend: http://forum.xda-developers.com/show...41#post2776841
 
NuShrike
Old
#3  
NuShrike's Avatar
Senior Recognized Developer - OP
Thanks Meter 10
Posts: 1,035
Join Date: Sep 2007
* more reserved *
 
NuShrike
Old
#4  
NuShrike's Avatar
Senior Recognized Developer - OP
Thanks Meter 10
Posts: 1,035
Join Date: Sep 2007
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;
}
 
ycavan
Old
#5  
Senior Member
Thanks Meter 7
Posts: 189
Join Date: 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
 
NuShrike
Old
(Last edited by NuShrike; 3rd September 2008 at 12:21 PM.)
#6  
NuShrike's Avatar
Senior Recognized Developer - OP
Thanks Meter 10
Posts: 1,035
Join Date: Sep 2007
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.
 
raiisak
Old
#7  
raiisak's Avatar
Senior Member
Thanks Meter 0
Posts: 1,051
Join Date: May 2008
Location: Oslo


100000xtimes thanks!
 
NetrunnerAT
Old
#8  
Senior Member
Thanks Meter 3
Posts: 1,334
Join Date: Mar 2007
Location: Vienna
can you make a sourceforce project??
 
ycavan
Old
(Last edited by ycavan; 9th August 2008 at 04:00 PM.)
#9  
Senior Member
Thanks Meter 7
Posts: 189
Join Date: Nov 2007
Quote:
Originally Posted by NuShrike View Post
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
 
cp_kirkley
Old
#10  
Senior Member
Thanks Meter 11
Posts: 263
Join Date: Oct 2007
Location: Cypress, TX, USA

 
DONATE TO ME
Quote:
Originally Posted by NuShrike View Post
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!?!
White Xperia Z Ultra 6802/Nvidia Shield

i5 3570k/16GB DDR3 1833/Z77X-UP4 TH/GTX 680 4GB/256GB Crucial M4
27"1440p

Previous Devices
iPaq 6315/Wizard/Apache/Vogue/Titan/Kaiser/iPhone 3G, iPhone 3GS/Leo T9193/X10a/iPhone 4/Focus/Captivate/Inspire/Xperia Play/SGS 2/Note N7000/HOX/Note 2/Note 8/GS4

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

Advanced Search
Display Modes


XDA PORTAL POSTS

[APK] Chrome Beta 37 Brings First Traces of Material Design

With Android L on the horizon, it’s no surprise that Google’s … more

Immersive Mode on Unrooted Devices with GMD Full Screen Immersive Mode

Everyone likes screen real estate–no question about that. The … more

Android Wear App Review: EchoWear Song Search – XDA Developer TV

Yesterday on XDA Developer TV, Producer AdamOutler tore down a Samsung … more