opengl 在 Mac os x下默认是2.1的问题

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

    // Insert code here to initialize your application

    NSRect mainDisplayRect = [[NSScreen mainScreen] frame];

    NSWindow *fullScreenWindow = [[NSWindow alloc] initWithContentRect: mainDisplayRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];

    [fullScreenWindow setLevel:NSMainMenuWindowLevel+1];    

    [fullScreenWindow setOpaque:YES];

    [fullScreenWindow setHidesOnDeactivate:YES];

    NSOpenGLPixelFormatAttribute attrs[] =

    {

        NSOpenGLPFADoubleBuffer,

        kCGLPFAOpenGLProfile,

        NSOpenGLProfileVersion3_2Core,

        0

    };

    NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];

    

    NSRect viewRect = NSMakeRect(0.0, 0.0, mainDisplayRect.size.width, mainDisplayRect.size.height);

    MyOpenGLView *fullScreenView = [[MyOpenGLView alloc] initWithFrame:viewRect pixelFormat: pixelFormat];

    [fullScreenWindow setContentView: fullScreenView];

    [fullScreenWindow makeKeyAndOrderFront:self];

}




输出:

2014-12-25 19:35:16.291 GoldenTriangle[662:20256] Opengl version: 2.1 INTEL-10.0.86

2014-12-25 19:35:16.399 GoldenTriangle[662:20256] Opengl version: 2.1 INTEL-10.0.86


2014-12-25 19:35:16.410 GoldenTriangle[662:20256] Opengl version: 4.1 INTEL-10.0.86

// glfw 下加

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);

    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);



你可能感兴趣的:(opengl 在 Mac os x下默认是2.1的问题)