src/video/cocoa/SDL_cocoaopengl.m
changeset 8278 e60a7bb2b80b
parent 8276 9bd65b58278e
child 8601 4c04c7785cba
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Sat Mar 01 20:59:43 2014 -0500
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Sat Mar 01 21:33:48 2014 -0500
     1.3 @@ -162,6 +162,7 @@
     1.4  Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
     1.5  {
     1.6      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     1.7 +    const GLubyte *(APIENTRY * glGetStringFunc)(GLenum) = NULL;
     1.8      NSAutoreleasePool *pool;
     1.9      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    1.10      SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
    1.11 @@ -275,7 +276,14 @@
    1.12          return NULL;
    1.13      }
    1.14  
    1.15 -    glversion = (const char *)glGetString(GL_VERSION);
    1.16 +    glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
    1.17 +    if (!glGetStringFunc) {
    1.18 +        Cocoa_GL_DeleteContext(_this, context);
    1.19 +        SDL_SetError ("Failed getting OpenGL glGetString entry point");
    1.20 +        return NULL;
    1.21 +    }
    1.22 +
    1.23 +    glversion = (const char *)glGetStringFunc(GL_VERSION);
    1.24      if (glversion == NULL) {
    1.25          Cocoa_GL_DeleteContext(_this, context);
    1.26          SDL_SetError ("Failed getting OpenGL context version");