New Computer == Open Gl code problem

KiroNeem
Unregistered
 
Post: #1
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;
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #2
I may just be stupid or whatnot but call me crazy.... are your returning err no matter what?

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
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.
Quote this message in a reply
KiroNeem
Unregistered
 
Post: #4
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.
Quote this message in a reply
KiroNeem
Unregistered
 
Post: #5
I was able to fix the code using the CGL method.... thanks again
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Frame buffer objects seem to be messing with my computer Jar445 2 3,390 Feb 24, 2009 08:59 AM
Last Post: Jar445
  PNG problem - can't open the file anthony 6 3,595 Feb 23, 2007 06:19 PM
Last Post: OneSadCookie
  Cocoa Texture Loading Code Problem Nick 1 3,083 Oct 28, 2005 11:44 PM
Last Post: OneSadCookie