iDevGames Forums
New Computer == Open Gl code problem - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: New Computer == Open Gl code problem (/thread-5692.html)



New Computer == Open Gl code problem - KiroNeem - Mar 30, 2005 06:41 PM

I just purchased a Powerbook g4 and everything was going fine. Then when i finally sat down to compile some of my projects on the new machine my OpenGL code was skrewing up. For some reason whenever I add the attribute AGL_FULLSCREEN to my pixelformat it doesn't actually make a context. If anyone has any insite to this please tell me, because I have been working at it and have gotten no where. Here is the code I'm using. Also the video card I have is a GeForce FX Go5200 64mb.


//Init Full Screen Context--------------------------------------------------
AGLContext aglContext;
AGLPixelFormat aglPixFmt;
GLint attrib[] = { AGL_RGBA, AGL_ACCELERATED, AGL_DOUBLEBUFFER, AGL_FULLSCREEN, AGL_NO_RECOVERY, AGL_NONE };
aglPixFmt = aglChoosePixelFormat( NULL, 0, attrib );
aglContext = aglCreateContext( aglPixFmt, NULL );

aglDestroyPixelFormat( aglPixFmt );

HideCursor();

aglSetFullScreen( aglContext, kScreenWidth, kScreenHeight, 30, 0 );
aglSetCurrentContext( aglContext );



glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluOrtho2D( 0, kScreenWidth, 0, kScreenHeight );
glMatrixMode( GL_MODELVIEW );

glClearColor( 0.0, 0.0, 0.0, 0.0 );
glShadeModel( GL_SMOOTH );
glEnable( GL_TEXTURE_2D );
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0 );
glDisable( GL_CULL_FACE );

glColor3f( 1, 1, 1 );
glClear( GL_COLOR_BUFFER_BIT );


if( aglContext == NULL )
printf("No OpenGL Context was created\n");

return err;


New Computer == Open Gl code problem - kodex - Mar 30, 2005 06:59 PM

I may just be stupid or whatnot but call me crazy.... are your returning err no matter what?


New Computer == Open Gl code problem - OneSadCookie - Mar 30, 2005 07:16 PM

you need to pass a GDevice to aglChoosePixelFormat. NULL (all screens) doesn't work on PowerBooks for some slightly odd reason to do with the external screen support.

This is a general point -- whether it's a GDevice to aglChoosePixelFormat, or a display mask to CGLChoosePixelFormat, you always need to specify one display for your full-screen context to run on, or your code will fail on multi-card systems and PowerBooks.


New Computer == Open Gl code problem - KiroNeem - Mar 30, 2005 11:21 PM

Thanks for the help. Although after trying to pass a GDHandle to it, it still doens't work.

Also yes I was always returning err... but this is meshed code anyways, very alpha quality.


New Computer == Open Gl code problem - KiroNeem - Mar 31, 2005 09:40 AM

I was able to fix the code using the CGL method.... thanks again