From: Ryan C. Gordon Date: Wed, 19 Aug 2009 03:13:54 +0000 (-0400) Subject: Cleaned up incorrect OpenGL init code. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=f415499bb932770841f668fb6dc1ea6c76cbf494;p=lugaru.git Cleaned up incorrect OpenGL init code. --- diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 4c83269..17766db 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -142,23 +142,22 @@ typedef struct tagPOINT { #include "glstubs.h" #undef GL_FUNC -static bool lookup_glsym(const char *funcname, void **func, const char *libname) +static bool lookup_glsym(const char *funcname, void **func) { *func = SDL_GL_GetProcAddress(funcname); if (*func == NULL) { - fprintf(stderr, "Failed to find OpenGL symbol \"%s\" in \"%s\"\n", - funcname, libname); + fprintf(stderr, "Failed to find OpenGL symbol \"%s\"\n", funcname); return false; } return true; } -static bool lookup_all_glsyms(const char *libname) +static bool lookup_all_glsyms(void) { bool retval = true; #define GL_FUNC(ret,fn,params,call,rt) \ - if (!lookup_glsym(#fn, (void **) &p##fn, libname)) retval = false; + if (!lookup_glsym(#fn, (void **) &p##fn)) retval = false; #include "glstubs.h" #undef GL_FUNC return retval; @@ -873,16 +872,12 @@ Boolean SetUp (Game & game) return false; } - const char *libname = "libGL.so.1"; // !!! FIXME: Linux specific! - if (SDL_GL_LoadLibrary(libname) == -1) + if (SDL_GL_LoadLibrary(NULL) == -1) { - fprintf(stderr, "SDL_GL_LoadLibrary(\"%s\") failed: %s\n", - libname, SDL_GetError()); + fprintf(stderr, "SDL_GL_LoadLibrary() failed: %s\n", SDL_GetError()); + SDL_Quit(); return false; } - - if (!lookup_all_glsyms(libname)) - return false; } Uint32 sdlflags = SDL_OPENGL; @@ -899,6 +894,12 @@ Boolean SetUp (Game & game) return false; } + if (!lookup_all_glsyms()) + { + SDL_Quit(); + return false; + } + if (!cmdline("nomousegrab")) SDL_WM_GrabInput(SDL_GRAB_ON);