We need to lookup the address of glGetString before calling GL_MakeCurrent(),
authorRyan C. Gordon <icculus@icculus.org>
Sat, 12 Jul 2003 13:30:30 +0000
changeset 650 fe445b59d307
parent 649 81c74904f51f
child 651 35ff0890ac4e
We need to lookup the address of glGetString before calling GL_MakeCurrent(), since the X11 target needs to query for extensions in there...hopefully this other platforms don't need to have a current context before symbol lookup works or something strange like that... --ryan.
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Thu Jul 10 07:56:19 2003 +0000
+++ b/src/video/SDL_video.c	Sat Jul 12 13:30:30 2003 +0000
@@ -722,6 +722,22 @@
 	SDL_WM_GrabInput(saved_grab);
 	SDL_GetRelativeMouseState(NULL, NULL); /* Clear first large delta */
 
+#ifdef HAVE_OPENGL
+	/* Load GL symbols (before MakeCurrent, where we need glGetString). */
+	if ( flags & (SDL_OPENGL | SDL_OPENGLBLIT) ) {
+#define SDL_PROC(ret,func,params) \
+do { \
+	video->func = SDL_GL_GetProcAddress(#func); \
+	if ( ! video->func ) { \
+		SDL_SetError("Couldn't load GL function: %s\n", #func); \
+		return(NULL); \
+	} \
+} while ( 0 );
+#include "SDL_glfuncs.h"
+#undef SDL_PROC	
+	}
+#endif
+
 	/* If we're running OpenGL, make the context current */
 	if ( (video->screen->flags & SDL_OPENGL) &&
 	      video->GL_MakeCurrent ) {
@@ -734,16 +750,6 @@
 	if ( (flags & SDL_OPENGLBLIT) == SDL_OPENGLBLIT ) {
 		/* Load GL functions for performing the texture updates */
 #ifdef HAVE_OPENGL
-#define SDL_PROC(ret,func,params) \
-do { \
-	video->func = SDL_GL_GetProcAddress(#func); \
-	if ( ! video->func ) { \
-		SDL_SetError("Couldn't load GL function: %s\n", #func); \
-		return(NULL); \
-	} \
-} while ( 0 );
-#include "SDL_glfuncs.h"
-#undef SDL_PROC	
 
 		/* Create a software surface for blitting */
 #ifdef GL_VERSION_1_2