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 7152 e9ed46195235
parent 7151 99a4964db4c3
child 7153 51cf5475ac56
Implemented SDL_GL_SHARE_WITH_CURRENT_CONTEXT for Mac OS X.
src/video/cocoa/SDL_cocoaopengl.m
--- a/src/video/cocoa/SDL_cocoaopengl.m	Sun May 05 11:17:40 2013 -0700
+++ b/src/video/cocoa/SDL_cocoaopengl.m	Sun May 05 21:01:20 2013 -0400
@@ -90,6 +90,7 @@
     NSOpenGLPixelFormatAttribute attr[32];
     NSOpenGLPixelFormat *fmt;
     NSOpenGLContext *context;
+    NSOpenGLContext *share_context = nil;
     int i = 0;
 
     if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
@@ -182,7 +183,11 @@
         return NULL;
     }
 
-    context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
+    if (_this->gl_config.share_with_current_context) {
+        share_context = (NSOpenGLContext*)(_this->current_glctx);
+    }
+
+    context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
 
     [fmt release];