Created
January 18, 2014 23:08
-
-
Save atduskgreg/8498097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSOpenGLPixelFormatAttribute attr[] = | |
{ | |
NSOpenGLPFADoubleBuffer, | |
NSOpenGLPFAAccelerated, | |
NSOpenGLPFADepthSize, 24, | |
NSOpenGLPFAMultisample, | |
NSOpenGLPFASampleBuffers, 1, | |
NSOpenGLPFASamples, 4, | |
(NSOpenGLPixelFormatAttribute) 0 | |
}; | |
// Make our GL Pixel Format | |
NSOpenGLPixelFormat* pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr]; | |
if(!pf) | |
NSLog(@"Could not create pixel format, falling back to simpler pixel format"); | |
NSOpenGLPixelFormatAttribute simpleattr[] = | |
{ | |
NSOpenGLPFADoubleBuffer, | |
NSOpenGLPFAAccelerated, | |
(NSOpenGLPixelFormatAttribute) 0 | |
}; | |
pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:simpleattr]; | |
if(!pf) | |
{ | |
NSLog(@"Could not create pixel format, bailing"); | |
[NSApp terminate:self]; | |
} | |
self.glContext = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil]; | |
[self.glContext makeCurrentContext]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment