diff --git a/desmume/src/cocoa/OGLDisplayOutput.h b/desmume/src/cocoa/OGLDisplayOutput.h index 20109b259..9c726063f 100644 --- a/desmume/src/cocoa/OGLDisplayOutput.h +++ b/desmume/src/cocoa/OGLDisplayOutput.h @@ -405,6 +405,8 @@ public: virtual void SetViewportSizeOGL(GLsizei w, GLsizei h); }; +OGLInfo* OGLInfoCreate_Legacy(); + extern OGLInfo* (*OGLInfoCreate_Func)(); extern void (*glBindVertexArrayDESMUME)(GLuint id); extern void (*glDeleteVertexArraysDESMUME)(GLsizei n, const GLuint *ids); diff --git a/desmume/src/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/cocoa/userinterface/DisplayWindowController.mm index ac6fe2b56..2b49e0aa0 100644 --- a/desmume/src/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.mm @@ -1316,19 +1316,36 @@ static std::unordered_map _screenMap; // (NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0 }; + NSOpenGLPixelFormat *format = nil; + #ifdef _OGLDISPLAYOUTPUT_3_2_H_ // If we can support a 3.2 Core Profile context, then request that in our // pixel format attributes. if (IsOSXVersionSupported(10, 7, 0)) { - attributes[9] = kCGLPFAOpenGLProfile; - attributes[10] = (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core; - + attributes[9] = NSOpenGLPFAOpenGLProfile; + attributes[10] = NSOpenGLProfileVersion3_2Core; OGLInfoCreate_Func = &OGLInfoCreate_3_2; + format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + + if (format == nil) + { + attributes[9] = NSOpenGLPFAOpenGLProfile; + attributes[10] = NSOpenGLProfileVersionLegacy; + OGLInfoCreate_Func = &OGLInfoCreate_Legacy; + format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + } } #endif - NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + if (format == nil) + { + attributes[9] = (NSOpenGLPixelFormatAttribute)0; + attributes[10] = (NSOpenGLPixelFormatAttribute)0; + OGLInfoCreate_Func = &OGLInfoCreate_Legacy; + format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + } + context = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil]; [format release]; cglDisplayContext = (CGLContextObj)[context CGLContextObj];