Implemented SDL_GL_SHARE_WITH_CURRENT_CONTEXT for Mac OS X.
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Sun, 05 May 2013 21:01:20 -0400
changeset 7152e9ed46195235
parent 7151 99a4964db4c3
child 7153 51cf5475ac56
Implemented SDL_GL_SHARE_WITH_CURRENT_CONTEXT for Mac OS X.
src/video/cocoa/SDL_cocoaopengl.m
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Sun May 05 11:17:40 2013 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Sun May 05 21:01:20 2013 -0400
     1.3 @@ -90,6 +90,7 @@
     1.4      NSOpenGLPixelFormatAttribute attr[32];
     1.5      NSOpenGLPixelFormat *fmt;
     1.6      NSOpenGLContext *context;
     1.7 +    NSOpenGLContext *share_context = nil;
     1.8      int i = 0;
     1.9  
    1.10      if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
    1.11 @@ -182,7 +183,11 @@
    1.12          return NULL;
    1.13      }
    1.14  
    1.15 -    context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
    1.16 +    if (_this->gl_config.share_with_current_context) {
    1.17 +        share_context = (NSOpenGLContext*)(_this->current_glctx);
    1.18 +    }
    1.19 +
    1.20 +    context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
    1.21  
    1.22      [fmt release];
    1.23