Updated GL version tests for Mac OS X 10.9 ("Mavericks").

They changed the name of their GL 3.2 enum, added the GL 4.1 core profile.
This commit is contained in:
Ryan C. Gordon 2013-10-28 22:43:39 -04:00
parent f570effbf5
commit d36c7363dd
1 changed files with 15 additions and 6 deletions

View File

@ -54,8 +54,11 @@
#ifndef kCGLOGLPVersion_Legacy #ifndef kCGLOGLPVersion_Legacy
#define kCGLOGLPVersion_Legacy 0x1000 #define kCGLOGLPVersion_Legacy 0x1000
#endif #endif
#ifndef kCGLOGLPVersion_3_2_Core #ifndef kCGLOGLPVersion_GL3_Core
#define kCGLOGLPVersion_3_2_Core 0x3200 #define kCGLOGLPVersion_GL3_Core 0x3200
#endif
#ifndef kCGLOGLPVersion_GL4_Core
#define kCGLOGLPVersion_GL4_Core 0x4100
#endif #endif
@implementation SDLOpenGLContext : NSOpenGLContext @implementation SDLOpenGLContext : NSOpenGLContext
@ -179,14 +182,14 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
int i = 0; int i = 0;
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
SDL_SetError ("OpenGL ES not supported on this platform"); SDL_SetError ("OpenGL ES is not supported on this platform");
return NULL; return NULL;
} }
/* Sadly, we'll have to update this as life progresses, since we need to /* Sadly, we'll have to update this as life progresses, since we need to
set an enum for context profiles, not a context version number */ set an enum for context profiles, not a context version number */
if (wantver > 0x0302) { if (wantver > 0x0401) {
SDL_SetError ("OpenGL > 3.2 is not supported on this platform"); SDL_SetError ("OpenGL > 4.1 is not supported on this platform");
return NULL; return NULL;
} }
@ -197,7 +200,13 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
NSOpenGLPixelFormatAttribute profile = kCGLOGLPVersion_Legacy; NSOpenGLPixelFormatAttribute profile = kCGLOGLPVersion_Legacy;
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
if (wantver == 0x0302) { if (wantver == 0x0302) {
profile = kCGLOGLPVersion_3_2_Core; profile = kCGLOGLPVersion_GL3_Core;
} else if ((wantver == 0x0401) && (data->osversion >= 0x1090)) {
profile = kCGLOGLPVersion_GL4_Core;
} else {
SDL_SetError("Requested GL version is not supported on this platform");
[pool release];
return NULL;
} }
} }
attr[i++] = kCGLPFAOpenGLProfile; attr[i++] = kCGLPFAOpenGLProfile;