src/video/cocoa/SDL_cocoaopengl.m
changeset 8986 1c81316ac642
parent 8604 459bd7365e9d
child 9587 18979eac0a35
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Mon Jul 07 11:44:14 2014 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Mon Jul 07 12:48:25 2014 -0700
     1.3 @@ -35,16 +35,6 @@
     1.4  
     1.5  #define DEFAULT_OPENGL  "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
     1.6  
     1.7 -#ifndef NSOpenGLPFAOpenGLProfile
     1.8 -#define NSOpenGLPFAOpenGLProfile 99
     1.9 -#endif
    1.10 -#ifndef NSOpenGLProfileVersionLegacy
    1.11 -#define NSOpenGLProfileVersionLegacy 0x1000
    1.12 -#endif
    1.13 -#ifndef NSOpenGLProfileVersion3_2Core
    1.14 -#define NSOpenGLProfileVersion3_2Core 0x3200
    1.15 -#endif
    1.16 -
    1.17  @implementation SDLOpenGLContext : NSOpenGLContext
    1.18  
    1.19  - (id)initWithFormat:(NSOpenGLPixelFormat *)format
    1.20 @@ -161,10 +151,10 @@
    1.21  SDL_GLContext
    1.22  Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
    1.23  {
    1.24 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.25      NSAutoreleasePool *pool;
    1.26      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    1.27      SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
    1.28 +    SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
    1.29      NSOpenGLPixelFormatAttribute attr[32];
    1.30      NSOpenGLPixelFormat *fmt;
    1.31      SDLOpenGLContext *context;
    1.32 @@ -178,7 +168,7 @@
    1.33          SDL_SetError ("OpenGL ES is not supported on this platform");
    1.34          return NULL;
    1.35      }
    1.36 -    if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && (data->osversion < 0x1070)) {
    1.37 +    if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) {
    1.38          SDL_SetError ("OpenGL Core Profile is not supported on this platform version");
    1.39          return NULL;
    1.40      }
    1.41 @@ -186,7 +176,7 @@
    1.42      pool = [[NSAutoreleasePool alloc] init];
    1.43  
    1.44      /* specify a profile if we're on Lion (10.7) or later. */
    1.45 -    if (data->osversion >= 0x1070) {
    1.46 +    if (lion_or_later) {
    1.47          NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
    1.48          if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
    1.49              profile = NSOpenGLProfileVersion3_2Core;