X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=17766dbb66ead777eb92cc6700c692949ce4f1f6;hb=f415499bb932770841f668fb6dc1ea6c76cbf494;hp=9d709dbc2685a0aa58e2feb7c00fe199997a5170;hpb=99d73d380e7376505a4033813d5d560ebaea05d1;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 9d709db..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); @@ -2679,10 +2680,6 @@ static bool load_png(const char *file_name, TGAImageRec &tex) if (!row_pointers) goto png_done; - retval = malloc(width * height * 4); - if (!retval) - goto png_done; - if (!hasalpha) { png_byte *dst = tex.data;