首页 > 代码库 > opengl 在 Mac os x下默认是2.1的问题
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
opengl 在 Mac os x下默认是2.1的问题