Fixed regression causing the renderer to recreate its window since it's not getting an OpenGL 2.1 context anymore.
authorSam Lantinga <slouken@libsdl.org>
Mon, 10 Mar 2014 18:45:07 -0700
changeset 86014c04c7785cba
parent 8600 092802455aed
child 8602 52ad5ab6eb2d
Fixed regression causing the renderer to recreate its window since it's not getting an OpenGL 2.1 context anymore.
src/video/SDL_video.c
src/video/cocoa/SDL_cocoaopengl.m
     1.1 --- a/src/video/SDL_video.c	Mon Mar 10 21:21:35 2014 -0400
     1.2 +++ b/src/video/SDL_video.c	Mon Mar 10 18:45:07 2014 -0700
     1.3 @@ -2563,10 +2563,10 @@
     1.4      _this->gl_config.multisamplesamples = 0;
     1.5      _this->gl_config.retained_backing = 1;
     1.6      _this->gl_config.accelerated = -1;  /* accelerated or not, both are fine */
     1.7 +    _this->gl_config.profile_mask = 0;
     1.8  #if SDL_VIDEO_OPENGL
     1.9 -    _this->gl_config.major_version = 1;
    1.10 -    _this->gl_config.minor_version = 2;
    1.11 -    _this->gl_config.profile_mask = 0;
    1.12 +    _this->gl_config.major_version = 2;
    1.13 +    _this->gl_config.minor_version = 1;
    1.14  #elif SDL_VIDEO_OPENGL_ES2
    1.15      _this->gl_config.major_version = 2;
    1.16      _this->gl_config.minor_version = 0;
     2.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Mon Mar 10 21:21:35 2014 -0400
     2.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Mon Mar 10 18:45:07 2014 -0700
     2.3 @@ -162,7 +162,9 @@
     2.4  Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
     2.5  {
     2.6      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     2.7 +/*
     2.8      const GLubyte *(APIENTRY * glGetStringFunc)(GLenum) = NULL;
     2.9 +*/
    2.10      NSAutoreleasePool *pool;
    2.11      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    2.12      SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
    2.13 @@ -249,7 +251,7 @@
    2.14  
    2.15      fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
    2.16      if (fmt == nil) {
    2.17 -        SDL_SetError ("Failed creating OpenGL pixel format");
    2.18 +        SDL_SetError("Failed creating OpenGL pixel format");
    2.19          [pool release];
    2.20          return NULL;
    2.21      }
    2.22 @@ -263,7 +265,7 @@
    2.23      [fmt release];
    2.24  
    2.25      if (context == nil) {
    2.26 -        SDL_SetError ("Failed creating OpenGL context");
    2.27 +        SDL_SetError("Failed creating OpenGL context");
    2.28          [pool release];
    2.29          return NULL;
    2.30      }
    2.31 @@ -272,10 +274,22 @@
    2.32  
    2.33      if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
    2.34          Cocoa_GL_DeleteContext(_this, context);
    2.35 -        SDL_SetError ("Failed making OpenGL context current");
    2.36 +        SDL_SetError("Failed making OpenGL context current");
    2.37          return NULL;
    2.38      }
    2.39  
    2.40 +/* No other backend does this version checking.
    2.41 +   If we enable it, we should consider whether it should be done at a 
    2.42 +   higher level for all platforms. We'll have to think through the implications
    2.43 +   of this.
    2.44 +
    2.45 +   For example, Mac OS X 10.6 will only report OpenGL 2.0, but we ask for 2.1
    2.46 +   by default. If we don't get 2.1, then the renderer will set the requested
    2.47 +   version and try to recreate the window, which causes all kinds of problems.
    2.48 +
    2.49 +   For now, we'll just disable this code until we can think about it more.
    2.50 +*/
    2.51 +#if 0
    2.52      glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
    2.53      if (!glGetStringFunc) {
    2.54          Cocoa_GL_DeleteContext(_this, context);
    2.55 @@ -305,6 +319,7 @@
    2.56  
    2.57      _this->gl_config.major_version = glversion_major;
    2.58      _this->gl_config.minor_version = glversion_minor;
    2.59 +#endif
    2.60  
    2.61      return context;
    2.62  }