Don't look for (and fail without) glGetIntegerv() until we need to.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 26 May 2015 10:25:15 -0400
changeset 962126a7259520cd
parent 9620 2a9739ca6440
child 9622 fb91c22f656b
Don't look for (and fail without) glGetIntegerv() until we need to.

Fixes Bugzilla #2615.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Tue May 26 06:32:19 2015 -0700
     1.2 +++ b/src/video/SDL_video.c	Tue May 26 10:25:15 2015 -0400
     1.3 @@ -2793,7 +2793,6 @@
     1.4  SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
     1.5  {
     1.6  #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
     1.7 -    void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
     1.8      GLenum (APIENTRY *glGetErrorFunc) (void);
     1.9      GLenum attrib = 0;
    1.10      GLenum error = 0;
    1.11 @@ -2816,11 +2815,6 @@
    1.12      }
    1.13  #endif
    1.14  
    1.15 -    glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
    1.16 -    if (!glGetIntegervFunc) {
    1.17 -        return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
    1.18 -    }
    1.19 -
    1.20      glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
    1.21      if (!glGetErrorFunc) {
    1.22          return SDL_SetError("Failed getting OpenGL glGetError entry point");
    1.23 @@ -3007,7 +3001,13 @@
    1.24      } else
    1.25  #endif
    1.26      {
    1.27 -        glGetIntegervFunc(attrib, (GLint *) value);
    1.28 +        void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
    1.29 +        glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
    1.30 +        if (glGetIntegervFunc) {
    1.31 +            glGetIntegervFunc(attrib, (GLint *) value);
    1.32 +        } else {
    1.33 +            return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
    1.34 +        }
    1.35      }
    1.36  
    1.37      error = glGetErrorFunc();