src/video/cocoa/SDL_cocoaopengl.m
changeset 7408 c50e165abfdf
parent 7389 361d1a0c90f6
child 7412 50211a1fd557
equal deleted inserted replaced
7407:db8a19d767d7 7408:c50e165abfdf
   210 
   210 
   211     if (context) {
   211     if (context) {
   212         SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata;
   212         SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata;
   213         NSOpenGLContext *nscontext = (NSOpenGLContext *)context;
   213         NSOpenGLContext *nscontext = (NSOpenGLContext *)context;
   214 
   214 
       
   215         windowdata->nscontext = nscontext;
   215         if ([nscontext view] != [windowdata->nswindow contentView]) {
   216         if ([nscontext view] != [windowdata->nswindow contentView]) {
   216             [nscontext setView:[windowdata->nswindow contentView]];
   217             [nscontext setView:[windowdata->nswindow contentView]];
   217             [nscontext update];
   218             [nscontext update];
   218         }
   219         }
   219         [nscontext makeCurrentContext];
   220         [nscontext makeCurrentContext];
   270 
   271 
   271 void
   272 void
   272 Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
   273 Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
   273 {
   274 {
   274     NSAutoreleasePool *pool;
   275     NSAutoreleasePool *pool;
   275     NSOpenGLContext *nscontext;
   276     SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata;
   276 
   277     NSOpenGLContext *nscontext = windowdata->nscontext;
   277     pool = [[NSAutoreleasePool alloc] init];
   278 
   278 
   279     pool = [[NSAutoreleasePool alloc] init];
   279     /* FIXME: Do we need to get the context for the window? */
   280 
   280     [[NSOpenGLContext currentContext] flushBuffer];
   281     [nscontext flushBuffer];
   281 
   282 
   282     [pool release];
   283     [pool release];
   283 }
   284 }
   284 
   285 
   285 void
   286 void