OpenGL 3.2 on MacBook Air

Sage
Posts: 1,066
Joined: 2004.07
Post: #1
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);
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #3
Thanks, I'll give that a try when I get home from work tonight.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #4
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  GLSL fragment program limits on GMA950 (MacBook) memon 12 8,973 Oct 26, 2007 05:18 PM
Last Post: arekkusu