src/video/cocoa/SDL_cocoaopengl.m
changeset 2178 114a541cfae2
parent 1973 81255f93dfcd
child 2540 56cf872c723a
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Thu Jul 12 05:32:07 2007 +0000
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Jul 12 06:31:36 2007 +0000
     1.3 @@ -150,7 +150,7 @@
     1.4      SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
     1.5      NSOpenGLPixelFormatAttribute attr[32];
     1.6      NSOpenGLPixelFormat *fmt;
     1.7 -    NSOpenGLContext *nscontext;
     1.8 +    NSOpenGLContext *context;
     1.9      int i = 0;
    1.10  
    1.11      pool = [[NSAutoreleasePool alloc] init];
    1.12 @@ -212,11 +212,11 @@
    1.13          return NULL;
    1.14      }
    1.15  
    1.16 -    nscontext = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
    1.17 +    context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
    1.18  
    1.19      [fmt release];
    1.20  
    1.21 -    if (nscontext == nil) {
    1.22 +    if (context == nil) {
    1.23          SDL_SetError ("Failed creating OpenGL context");
    1.24          [pool release];
    1.25          return NULL;
    1.26 @@ -240,7 +240,7 @@
    1.27  
    1.28      {
    1.29          long cache_max = 64;
    1.30 -        CGLContextObj ctx = [nscontext CGLContextObj];
    1.31 +        CGLContextObj ctx = [context CGLContextObj];
    1.32          CGLSetParameter (ctx, GLI_SUBMIT_FUNC_CACHE_MAX, &cache_max);
    1.33          CGLSetParameter (ctx, GLI_ARRAY_FUNC_CACHE_MAX, &cache_max);
    1.34      }
    1.35 @@ -248,7 +248,13 @@
    1.36      /* End Wisdom from Apple Engineer section. --ryan. */
    1.37  
    1.38      [pool release];
    1.39 -    return nscontext;
    1.40 +
    1.41 +    if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
    1.42 +        Cocoa_GL_DeleteContext(_this, context);
    1.43 +        return NULL;
    1.44 +    }
    1.45 +
    1.46 +    return context;
    1.47  }
    1.48  
    1.49  int