diff src/video/win32/SDL_win32opengl.c @ 1952:420716272158

Implemented X11 OpenGL support. Added support for the SDL_VIDEO_OPENGL environment variable.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Jul 2006 08:43:17 +0000
parents 83946ee0ff1f
children abbe2c1dcf0a
line wrap: on
line diff
--- a/src/video/win32/SDL_win32opengl.c	Thu Jul 27 06:53:23 2006 +0000
+++ b/src/video/win32/SDL_win32opengl.c	Fri Jul 28 08:43:17 2006 +0000
@@ -25,10 +25,10 @@
 
 /* WGL implementation of SDL OpenGL support */
 
-#if SDL_VIDEO_OPENGL
+#if SDL_VIDEO_OPENGL_WGL
 #include "SDL_opengl.h"
 
-#define DEFAULT_OPENGL_PATH "OPENGL32.DLL"
+#define DEFAULT_OPENGL "OPENGL32.DLL"
 
 
 int
@@ -47,7 +47,10 @@
         }
     }
     if (path == NULL) {
-        path = DEFAULT_OPENGL_PATH;
+        path = SDL_getenv("SDL_OPENGL_LIBRARY");
+    }
+    if (path == NULL) {
+        path = DEFAULT_OPENGL;
     }
     wpath = WIN_UTF8ToString(path);
     handle = LoadLibrary(wpath);
@@ -257,19 +260,6 @@
     WIN_PumpEvents(_this);
 }
 
-static void
-WIN_GL_Shutdown(_THIS)
-{
-    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
-        return;
-    }
-
-    WIN_GL_UnloadLibrary(_this);
-
-    SDL_free(_this->gl_data);
-    _this->gl_data = NULL;
-}
-
 static int
 WIN_GL_Initialize(_THIS)
 {
@@ -298,6 +288,19 @@
     return 0;
 }
 
+static void
+WIN_GL_Shutdown(_THIS)
+{
+    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
+        return;
+    }
+
+    WIN_GL_UnloadLibrary(_this);
+
+    SDL_free(_this->gl_data);
+    _this->gl_data = NULL;
+}
+
 int
 WIN_GL_SetupWindow(_THIS, SDL_Window * window)
 {
@@ -479,7 +482,6 @@
     _this->gl_data->wglDeleteContext((HGLRC) context);
 }
 
-#endif /* SDL_VIDEO_OPENGL */
-
+#endif /* SDL_VIDEO_OPENGL_WGL */
 
 /* vi: set ts=4 sw=4 expandtab: */