src/video/cocoa/SDL_cocoaopengl.m
author Sam Lantinga <slouken@libsdl.org>
Mon, 04 Dec 2017 20:35:01 -0800
changeset 11723 bc7ca7cfa6ca
parent 10737 3406a0f8b041
child 11811 5d94cb6b24d3
permissions -rw-r--r--
Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library

Andrey

Seems latest google angle library successfully built & tested under macOS'es.

https://github.com/google/angle

We need to use GLES2 to implement true cross-platform code.
slouken@1936
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@1936
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@1936
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@1936
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@1936
    20
*/
icculus@8093
    21
#include "../../SDL_internal.h"
slouken@1936
    22
slouken@1936
    23
/* NSOpenGL implementation of SDL OpenGL support */
slouken@1936
    24
slouken@1952
    25
#if SDL_VIDEO_OPENGL_CGL
slouken@6044
    26
#include "SDL_cocoavideo.h"
jorgen@7594
    27
#include "SDL_cocoaopengl.h"
slouken@11723
    28
#include "SDL_cocoaopengles.h"
slouken@6044
    29
slouken@1936
    30
#include <OpenGL/CGLTypes.h>
slouken@2738
    31
#include <OpenGL/OpenGL.h>
slouken@3570
    32
#include <OpenGL/CGLRenderers.h>
slouken@1936
    33
slouken@1936
    34
#include "SDL_loadso.h"
slouken@1936
    35
#include "SDL_opengl.h"
slouken@1936
    36
icculus@6567
    37
#define DEFAULT_OPENGL  "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
slouken@1936
    38
jorgen@7594
    39
@implementation SDLOpenGLContext : NSOpenGLContext
jorgen@7594
    40
jorgen@7594
    41
- (id)initWithFormat:(NSOpenGLPixelFormat *)format
jorgen@7594
    42
        shareContext:(NSOpenGLContext *)share
jorgen@7594
    43
{
jorgen@7595
    44
    self = [super initWithFormat:format shareContext:share];
jorgen@7595
    45
    if (self) {
jorgen@7595
    46
        SDL_AtomicSet(&self->dirty, 0);
jorgen@7595
    47
        self->window = NULL;
jorgen@7595
    48
    }
jorgen@7595
    49
    return self;
jorgen@7594
    50
}
jorgen@7594
    51
jorgen@7594
    52
- (void)scheduleUpdate
jorgen@7594
    53
{
jorgen@7594
    54
    SDL_AtomicAdd(&self->dirty, 1);
jorgen@7594
    55
}
jorgen@7594
    56
jorgen@7594
    57
/* This should only be called on the thread on which a user is using the context. */
jorgen@7594
    58
- (void)updateIfNeeded
jorgen@7594
    59
{
jorgen@7594
    60
    int value = SDL_AtomicSet(&self->dirty, 0);
jorgen@7594
    61
    if (value > 0) {
jorgen@7594
    62
        /* We call the real underlying update here, since -[SDLOpenGLContext update] just calls us. */
jorgen@7594
    63
        [super update];
jorgen@7594
    64
    }
jorgen@7594
    65
}
jorgen@7594
    66
jorgen@7594
    67
/* This should only be called on the thread on which a user is using the context. */
jorgen@7594
    68
- (void)update
jorgen@7594
    69
{
jorgen@7594
    70
    /* This ensures that regular 'update' calls clear the atomic dirty flag. */
jorgen@7594
    71
    [self scheduleUpdate];
jorgen@7594
    72
    [self updateIfNeeded];
jorgen@7594
    73
}
jorgen@7594
    74
jorgen@7595
    75
/* Updates the drawable for the contexts and manages related state. */
jorgen@7595
    76
- (void)setWindow:(SDL_Window *)newWindow
jorgen@7595
    77
{
jorgen@7595
    78
    if (self->window) {
jorgen@7595
    79
        SDL_WindowData *oldwindowdata = (SDL_WindowData *)self->window->driverdata;
jorgen@7595
    80
jorgen@7595
    81
        /* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */
jorgen@7595
    82
        NSMutableArray *contexts = oldwindowdata->nscontexts;
jorgen@7595
    83
        @synchronized (contexts) {
jorgen@7595
    84
            [contexts removeObject:self];
jorgen@7595
    85
        }
jorgen@7595
    86
    }
jorgen@7595
    87
jorgen@7595
    88
    self->window = newWindow;
jorgen@7595
    89
jorgen@7595
    90
    if (newWindow) {
jorgen@7595
    91
        SDL_WindowData *windowdata = (SDL_WindowData *)newWindow->driverdata;
jorgen@7595
    92
jorgen@7595
    93
        /* Now sign up for scheduled updates for the new window. */
jorgen@7595
    94
        NSMutableArray *contexts = windowdata->nscontexts;
jorgen@7595
    95
        @synchronized (contexts) {
jorgen@7595
    96
            [contexts addObject:self];
jorgen@7595
    97
        }
jorgen@7595
    98
jorgen@7595
    99
        if ([self view] != [windowdata->nswindow contentView]) {
jorgen@7595
   100
            [self setView:[windowdata->nswindow contentView]];
jorgen@8258
   101
            if (self == [NSOpenGLContext currentContext]) {
jorgen@8258
   102
                [self update];
jorgen@8258
   103
            } else {
jorgen@8258
   104
                [self scheduleUpdate];
jorgen@8258
   105
            }
jorgen@7595
   106
        }
jorgen@7595
   107
    } else {
jorgen@7595
   108
        [self clearDrawable];
jorgen@8258
   109
        if (self == [NSOpenGLContext currentContext]) {
jorgen@8258
   110
            [self update];
jorgen@8258
   111
        } else {
jorgen@8258
   112
            [self scheduleUpdate];
jorgen@8258
   113
        }
jorgen@7595
   114
    }
jorgen@7595
   115
}
jorgen@7595
   116
jorgen@7594
   117
@end
jorgen@7594
   118
slouken@1936
   119
slouken@1936
   120
int
slouken@1936
   121
Cocoa_GL_LoadLibrary(_THIS, const char *path)
slouken@1936
   122
{
slouken@3057
   123
    /* Load the OpenGL library */
slouken@1936
   124
    if (path == NULL) {
slouken@1952
   125
        path = SDL_getenv("SDL_OPENGL_LIBRARY");
slouken@1952
   126
    }
slouken@1952
   127
    if (path == NULL) {
slouken@1952
   128
        path = DEFAULT_OPENGL;
slouken@1936
   129
    }
slouken@1936
   130
    _this->gl_config.dll_handle = SDL_LoadObject(path);
slouken@1936
   131
    if (!_this->gl_config.dll_handle) {
slouken@1936
   132
        return -1;
slouken@1936
   133
    }
slouken@1936
   134
    SDL_strlcpy(_this->gl_config.driver_path, path,
slouken@1936
   135
                SDL_arraysize(_this->gl_config.driver_path));
slouken@1936
   136
    return 0;
slouken@1936
   137
}
slouken@1936
   138
slouken@1936
   139
void *
slouken@1936
   140
Cocoa_GL_GetProcAddress(_THIS, const char *proc)
slouken@1936
   141
{
slouken@1936
   142
    return SDL_LoadFunction(_this->gl_config.dll_handle, proc);
slouken@1936
   143
}
slouken@1936
   144
slouken@3057
   145
void
slouken@1936
   146
Cocoa_GL_UnloadLibrary(_THIS)
slouken@1936
   147
{
slouken@3057
   148
    SDL_UnloadObject(_this->gl_config.dll_handle);
slouken@3057
   149
    _this->gl_config.dll_handle = NULL;
slouken@1936
   150
}
slouken@1936
   151
slouken@1936
   152
SDL_GLContext
slouken@1936
   153
Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
slime73@9587
   154
{ @autoreleasepool
slouken@1936
   155
{
slouken@5246
   156
    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
slouken@1936
   157
    SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
slouken@8986
   158
    SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
slouken@1936
   159
    NSOpenGLPixelFormatAttribute attr[32];
slouken@1936
   160
    NSOpenGLPixelFormat *fmt;
jorgen@7594
   161
    SDLOpenGLContext *context;
flibitijibibo@7152
   162
    NSOpenGLContext *share_context = nil;
slouken@1936
   163
    int i = 0;
icculus@8276
   164
    const char *glversion;
icculus@8276
   165
    int glversion_major;
icculus@8276
   166
    int glversion_minor;
slouken@1936
   167
icculus@6567
   168
    if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
slouken@11723
   169
#if SDL_VIDEO_OPENGL_EGL
slouken@11723
   170
        /* Switch to EGL based functions */
slouken@11723
   171
        Cocoa_GL_UnloadLibrary(_this);
slouken@11723
   172
        _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary;
slouken@11723
   173
        _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress;
slouken@11723
   174
        _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
slouken@11723
   175
        _this->GL_CreateContext = Cocoa_GLES_CreateContext;
slouken@11723
   176
        _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
slouken@11723
   177
        _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
slouken@11723
   178
        _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
slouken@11723
   179
        _this->GL_SwapWindow = Cocoa_GLES_SwapWindow;
slouken@11723
   180
        _this->GL_DeleteContext = Cocoa_GLES_DeleteContext;
slouken@11723
   181
        
slouken@11723
   182
        if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) {
slouken@11723
   183
            return NULL;
slouken@11723
   184
        }
slouken@11723
   185
        return Cocoa_GLES_CreateContext(_this, window);
slouken@11723
   186
#else
slouken@11723
   187
        SDL_SetError("SDL not configured with EGL support");
icculus@6567
   188
        return NULL;
slouken@11723
   189
#endif
icculus@6567
   190
    }
slouken@8986
   191
    if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) {
icculus@8276
   192
        SDL_SetError ("OpenGL Core Profile is not supported on this platform version");
icculus@6567
   193
        return NULL;
icculus@6567
   194
    }
icculus@6567
   195
icculus@10008
   196
    attr[i++] = NSOpenGLPFAAllowOfflineRenderers;
icculus@10008
   197
slouken@6848
   198
    /* specify a profile if we're on Lion (10.7) or later. */
slouken@8986
   199
    if (lion_or_later) {
icculus@8276
   200
        NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
slouken@6848
   201
        if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
icculus@8276
   202
            profile = NSOpenGLProfileVersion3_2Core;
alexey@6832
   203
        }
icculus@8276
   204
        attr[i++] = NSOpenGLPFAOpenGLProfile;
slouken@6848
   205
        attr[i++] = profile;
slouken@6848
   206
    }
slouken@1936
   207
slouken@6848
   208
    attr[i++] = NSOpenGLPFAColorSize;
slouken@6848
   209
    attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8;
slouken@6848
   210
slouken@6848
   211
    attr[i++] = NSOpenGLPFADepthSize;
slouken@6848
   212
    attr[i++] = _this->gl_config.depth_size;
slouken@6848
   213
slouken@6848
   214
    if (_this->gl_config.double_buffer) {
slouken@6848
   215
        attr[i++] = NSOpenGLPFADoubleBuffer;
slouken@6848
   216
    }
slouken@6848
   217
slouken@6848
   218
    if (_this->gl_config.stereo) {
slouken@6848
   219
        attr[i++] = NSOpenGLPFAStereo;
slouken@6848
   220
    }
slouken@6848
   221
slouken@6848
   222
    if (_this->gl_config.stencil_size) {
slouken@6848
   223
        attr[i++] = NSOpenGLPFAStencilSize;
slouken@6848
   224
        attr[i++] = _this->gl_config.stencil_size;
slouken@6848
   225
    }
slouken@6848
   226
slouken@6848
   227
    if ((_this->gl_config.accum_red_size +
slouken@6848
   228
         _this->gl_config.accum_green_size +
slouken@6848
   229
         _this->gl_config.accum_blue_size +
slouken@6848
   230
         _this->gl_config.accum_alpha_size) > 0) {
slouken@6848
   231
        attr[i++] = NSOpenGLPFAAccumSize;
slouken@6848
   232
        attr[i++] = _this->gl_config.accum_red_size + _this->gl_config.accum_green_size + _this->gl_config.accum_blue_size + _this->gl_config.accum_alpha_size;
slouken@6848
   233
    }
slouken@6848
   234
slouken@6848
   235
    if (_this->gl_config.multisamplebuffers) {
slouken@6848
   236
        attr[i++] = NSOpenGLPFASampleBuffers;
slouken@6848
   237
        attr[i++] = _this->gl_config.multisamplebuffers;
slouken@6848
   238
    }
slouken@6848
   239
slouken@6848
   240
    if (_this->gl_config.multisamplesamples) {
slouken@6848
   241
        attr[i++] = NSOpenGLPFASamples;
slouken@6848
   242
        attr[i++] = _this->gl_config.multisamplesamples;
slouken@6848
   243
        attr[i++] = NSOpenGLPFANoRecovery;
slouken@6848
   244
    }
slouken@6848
   245
slouken@6848
   246
    if (_this->gl_config.accelerated >= 0) {
slouken@6848
   247
        if (_this->gl_config.accelerated) {
slouken@6848
   248
            attr[i++] = NSOpenGLPFAAccelerated;
slouken@6848
   249
        } else {
slouken@6848
   250
            attr[i++] = NSOpenGLPFARendererID;
slouken@6848
   251
            attr[i++] = kCGLRendererGenericFloatID;
alexey@6832
   252
        }
slouken@6848
   253
    }
slouken@6848
   254
slouken@6848
   255
    attr[i++] = NSOpenGLPFAScreenMask;
slouken@6848
   256
    attr[i++] = CGDisplayIDToOpenGLDisplayMask(displaydata->display);
slouken@6848
   257
    attr[i] = 0;
slouken@6848
   258
slouken@6848
   259
    fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
slouken@6848
   260
    if (fmt == nil) {
slouken@8601
   261
        SDL_SetError("Failed creating OpenGL pixel format");
slouken@6848
   262
        return NULL;
slouken@6848
   263
    }
slouken@6848
   264
flibitijibibo@7152
   265
    if (_this->gl_config.share_with_current_context) {
slouken@7412
   266
        share_context = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
flibitijibibo@7152
   267
    }
flibitijibibo@7152
   268
jorgen@7594
   269
    context = [[SDLOpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
slouken@6848
   270
slouken@6848
   271
    [fmt release];
slouken@6848
   272
slouken@6848
   273
    if (context == nil) {
slouken@8601
   274
        SDL_SetError("Failed creating OpenGL context");
slouken@6848
   275
        return NULL;
slouken@6848
   276
    }
slouken@6848
   277
slouken@2178
   278
    if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
slouken@2178
   279
        Cocoa_GL_DeleteContext(_this, context);
slouken@8601
   280
        SDL_SetError("Failed making OpenGL context current");
slouken@2178
   281
        return NULL;
slouken@2178
   282
    }
slouken@2178
   283
slouken@8604
   284
    if (_this->gl_config.major_version < 3 &&
slouken@8604
   285
        _this->gl_config.profile_mask == 0 &&
slouken@8604
   286
        _this->gl_config.flags == 0) {
slouken@8604
   287
        /* This is a legacy profile, so to match other backends, we're done. */
slouken@8604
   288
    } else {
slouken@8604
   289
        const GLubyte *(APIENTRY * glGetStringFunc)(GLenum);
slouken@8601
   290
slouken@8604
   291
        glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
slouken@8604
   292
        if (!glGetStringFunc) {
slouken@8604
   293
            Cocoa_GL_DeleteContext(_this, context);
slouken@8604
   294
            SDL_SetError ("Failed getting OpenGL glGetString entry point");
slouken@8604
   295
            return NULL;
slouken@8604
   296
        }
slouken@8601
   297
slouken@8604
   298
        glversion = (const char *)glGetStringFunc(GL_VERSION);
slouken@8604
   299
        if (glversion == NULL) {
slouken@8604
   300
            Cocoa_GL_DeleteContext(_this, context);
slouken@8604
   301
            SDL_SetError ("Failed getting OpenGL context version");
slouken@8604
   302
            return NULL;
slouken@8604
   303
        }
slouken@8604
   304
slouken@8604
   305
        if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) {
slouken@8604
   306
            Cocoa_GL_DeleteContext(_this, context);
slouken@8604
   307
            SDL_SetError ("Failed parsing OpenGL context version");
slouken@8604
   308
            return NULL;
slouken@8604
   309
        }
slouken@8604
   310
slouken@8604
   311
        if ((glversion_major < _this->gl_config.major_version) ||
slouken@8604
   312
           ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) {
slouken@8604
   313
            Cocoa_GL_DeleteContext(_this, context);
slouken@8604
   314
            SDL_SetError ("Failed creating OpenGL context at version requested");
slouken@8604
   315
            return NULL;
slouken@8604
   316
        }
slouken@8604
   317
slouken@8604
   318
        /* In the future we'll want to do this, but to match other platforms
slouken@8604
   319
           we'll leave the OpenGL version the way it is for now
slouken@8604
   320
         */
slouken@8604
   321
        /*_this->gl_config.major_version = glversion_major;*/
slouken@8604
   322
        /*_this->gl_config.minor_version = glversion_minor;*/
icculus@8278
   323
    }
slouken@2178
   324
    return context;
slime73@9587
   325
}}
slouken@1936
   326
slouken@1936
   327
int
slouken@1936
   328
Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
slime73@9587
   329
{ @autoreleasepool
slouken@1936
   330
{
slouken@6848
   331
    if (context) {
jorgen@7594
   332
        SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
jorgen@7595
   333
        [nscontext setWindow:window];
jorgen@7594
   334
        [nscontext updateIfNeeded];
slouken@6848
   335
        [nscontext makeCurrentContext];
slouken@6848
   336
    } else {
slouken@6848
   337
        [NSOpenGLContext clearCurrentContext];
slouken@1936
   338
    }
slouken@1936
   339
slouken@1936
   340
    return 0;
slime73@9587
   341
}}
slouken@1936
   342
urkle@7746
   343
void
urkle@7746
   344
Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
urkle@7746
   345
{
urkle@7746
   346
    SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
urkle@7746
   347
    NSView *contentView = [windata->nswindow contentView];
urkle@7746
   348
    NSRect viewport = [contentView bounds];
urkle@7746
   349
urkle@7746
   350
    /* This gives us the correct viewport for a Retina-enabled view, only
urkle@7746
   351
     * supported on 10.7+. */
urkle@7746
   352
    if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
urkle@7746
   353
        viewport = [contentView convertRectToBacking:viewport];
urkle@7746
   354
    }
urkle@7746
   355
urkle@7746
   356
    if (w) {
urkle@7746
   357
        *w = viewport.size.width;
urkle@7746
   358
    }
urkle@7746
   359
urkle@7746
   360
    if (h) {
urkle@7746
   361
        *h = viewport.size.height;
urkle@7746
   362
    }
urkle@7746
   363
}
urkle@7746
   364
slouken@1936
   365
int
slouken@1936
   366
Cocoa_GL_SetSwapInterval(_THIS, int interval)
slime73@9587
   367
{ @autoreleasepool
slouken@1936
   368
{
slouken@1936
   369
    NSOpenGLContext *nscontext;
slouken@2703
   370
    GLint value;
slouken@1936
   371
    int status;
slouken@1936
   372
icculus@7743
   373
    if (interval < 0) {  /* no extension for this on Mac OS X at the moment. */
icculus@7743
   374
        return SDL_SetError("Late swap tearing currently unsupported");
icculus@7743
   375
    }
icculus@7743
   376
jorgen@7594
   377
    nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
slouken@6848
   378
    if (nscontext != nil) {
slouken@6848
   379
        value = interval;
slouken@6848
   380
        [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval];
slouken@6848
   381
        status = 0;
slouken@6848
   382
    } else {
icculus@7037
   383
        status = SDL_SetError("No current OpenGL context");
slouken@1936
   384
    }
slouken@1936
   385
slouken@1936
   386
    return status;
slime73@9587
   387
}}
slouken@1936
   388
slouken@1936
   389
int
slouken@1936
   390
Cocoa_GL_GetSwapInterval(_THIS)
slime73@9587
   391
{ @autoreleasepool
slouken@1936
   392
{
slouken@1936
   393
    NSOpenGLContext *nscontext;
slouken@2703
   394
    GLint value;
icculus@6382
   395
    int status = 0;
slouken@1936
   396
jorgen@7594
   397
    nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
slouken@6848
   398
    if (nscontext != nil) {
slouken@6848
   399
        [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval];
slouken@6848
   400
        status = (int)value;
slouken@1936
   401
    }
slouken@1936
   402
slouken@1936
   403
    return status;
slime73@9587
   404
}}
slouken@1936
   405
slouken@10690
   406
int
slouken@1936
   407
Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
slime73@9587
   408
{ @autoreleasepool
slouken@1936
   409
{
slouken@7738
   410
    SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext();
slouken@7408
   411
    [nscontext flushBuffer];
jorgen@7594
   412
    [nscontext updateIfNeeded];
slouken@10690
   413
    return 0;
slime73@9587
   414
}}
slouken@1936
   415
slouken@1936
   416
void
slouken@1936
   417
Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
slime73@9587
   418
{ @autoreleasepool
slouken@1936
   419
{
jorgen@7595
   420
    SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
slouken@1936
   421
jorgen@7595
   422
    [nscontext setWindow:NULL];
slouken@6848
   423
    [nscontext release];
slime73@9587
   424
}}
slouken@1936
   425
slouken@1952
   426
#endif /* SDL_VIDEO_OPENGL_CGL */
slouken@1936
   427
slouken@1936
   428
/* vi: set ts=4 sw=4 expandtab: */