iDevGames Forums
OpenGL 3.2 on MacBook Air - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenGL 3.2 on MacBook Air (/thread-9205.html)



OpenGL 3.2 on MacBook Air - Nick - Jul 21, 2011 08:28 AM

I have a MacBook Air with the NVIDIA GeForce 320M. I just got Lion installed and wanted to start playing with OpenGL 3.2. I watched one of the WWDC videos and they explained how to get a 3.2 context, however no matter what I try I always end up with a 2.1 version coming back from glGetString. Any ideas?

Here's the code I'm trying to use:

Code:
NSOpenGLPixelFormatAttribute attr[] =
{
    NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
    NSOpenGLPFAColorSize, 24,
    NSOpenGLPFAAlphaSize, 8,
    NSOpenGLPFAAccelerated, 0
};
    
NSOpenGLPixelFormat *pix = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];    
[self.glView setPixelFormat:pix];
    
NSString *versionString = [NSString stringWithCString:(const char*)glGetString(GL_VERSION)
                                             encoding:NSASCIIStringEncoding];
NSLog(@"OpenGL Version: %@", versionString);



RE: OpenGL 3.2 on MacBook Air - OneSadCookie - Jul 21, 2011 08:57 AM

I don't know that setting the pixel format on an OpenGL view recreates the context, and it certainly doesn't make the context current...

You might like to start with eg. https://github.com/onesadcookie/ObjCGameBase and modify the pixel format attributes there.


RE: OpenGL 3.2 on MacBook Air - Nick - Jul 21, 2011 09:16 AM

Thanks, I'll give that a try when I get home from work tonight.


RE: OpenGL 3.2 on MacBook Air - Nick - Jul 21, 2011 04:32 PM

You were right on the contexts. I changed to creating my own context and setting it on the view, plus calling the makeCurrentContext method and now I'm getting a nice 3.2 version back from OpenGL. Excellent. Thanks.