Fixed Mac OS X OpenGL context creation to match other backends, where we only care about the actual version we request if it's 3.0 or newer or a special profile context.

Eventually we'll probably move the version checking to higher level code and report the actual version of context that got created, but to avoid breakage we'll leave it like this for now.
main
Sam Lantinga 2014-03-10 19:59:06 -07:00
parent e99dc1f1bd
commit b677d1d883
2 changed files with 41 additions and 47 deletions

View File

@ -162,9 +162,6 @@ SDL_GLContext
Cocoa_GL_CreateContext(_THIS, SDL_Window * window) Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
/*
const GLubyte *(APIENTRY * glGetStringFunc)(GLenum) = NULL;
*/
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
@ -278,18 +275,13 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
return NULL; return NULL;
} }
/* No other backend does this version checking. if (_this->gl_config.major_version < 3 &&
If we enable it, we should consider whether it should be done at a _this->gl_config.profile_mask == 0 &&
higher level for all platforms. We'll have to think through the implications _this->gl_config.flags == 0) {
of this. /* This is a legacy profile, so to match other backends, we're done. */
} else {
const GLubyte *(APIENTRY * glGetStringFunc)(GLenum);
For example, Mac OS X 10.6 will only report OpenGL 2.0, but we ask for 2.1
by default. If we don't get 2.1, then the renderer will set the requested
version and try to recreate the window, which causes all kinds of problems.
For now, we'll just disable this code until we can think about it more.
*/
#if 0
glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString"); glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
if (!glGetStringFunc) { if (!glGetStringFunc) {
Cocoa_GL_DeleteContext(_this, context); Cocoa_GL_DeleteContext(_this, context);
@ -317,10 +309,12 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
return NULL; return NULL;
} }
_this->gl_config.major_version = glversion_major; /* In the future we'll want to do this, but to match other platforms
_this->gl_config.minor_version = glversion_minor; we'll leave the OpenGL version the way it is for now
#endif */
/*_this->gl_config.major_version = glversion_major;*/
/*_this->gl_config.minor_version = glversion_minor;*/
}
return context; return context;
} }