PDA

View Full Version : New Computer == Open Gl code problem


KiroNeem
2005.03.30, 09: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;

kodex
2005.03.30, 09:59 PM
I may just be stupid or whatnot but call me crazy.... are your returning err no matter what?

OneSadCookie
2005.03.30, 10: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.

KiroNeem
2005.03.31, 02:21 AM
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.

KiroNeem
2005.03.31, 12:40 PM
I was able to fix the code using the CGL method.... thanks again