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 9621 26a7259520cd
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
--- a/src/video/SDL_video.c	Tue May 26 06:32:19 2015 -0700
+++ b/src/video/SDL_video.c	Tue May 26 10:25:15 2015 -0400
@@ -2793,7 +2793,6 @@
 SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
 {
 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
-    void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
     GLenum (APIENTRY *glGetErrorFunc) (void);
     GLenum attrib = 0;
     GLenum error = 0;
@@ -2816,11 +2815,6 @@
     }
 #endif
 
-    glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
-    if (!glGetIntegervFunc) {
-        return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
-    }
-
     glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
     if (!glGetErrorFunc) {
         return SDL_SetError("Failed getting OpenGL glGetError entry point");
@@ -3007,7 +3001,13 @@
     } else
 #endif
     {
-        glGetIntegervFunc(attrib, (GLint *) value);
+        void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
+        glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+        if (glGetIntegervFunc) {
+            glGetIntegervFunc(attrib, (GLint *) value);
+        } else {
+            return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
+        }
     }
 
     error = glGetErrorFunc();