diff --git a/include/r_cvar.h b/include/r_cvar.h index bc963189b..f8236f00f 100644 --- a/include/r_cvar.h +++ b/include/r_cvar.h @@ -20,7 +20,7 @@ extern struct cvar_s *gl_fb_models; extern struct cvar_s *gl_fires; extern struct cvar_s *gl_keeptjunctions; extern struct cvar_s *gl_lerp_anim; -extern struct cvar_s *gl_libgl; +extern struct cvar_s *gl_driver; extern struct cvar_s *gl_lightmap_align; extern struct cvar_s *gl_lightmap_subimage; extern struct cvar_s *gl_max_size; diff --git a/libs/video/renderer/gl/gl_funcs.c b/libs/video/renderer/gl/gl_funcs.c index b1c5cb50e..24fe2affe 100644 --- a/libs/video/renderer/gl/gl_funcs.c +++ b/libs/video/renderer/gl/gl_funcs.c @@ -65,14 +65,14 @@ GLF_Init (void) void *handle; #if defined(HAVE_DLOPEN) - if (!(handle = dlopen (gl_libgl->string, RTLD_NOW))) { - Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_libgl->string, + if (!(handle = dlopen (gl_driver->string, RTLD_NOW))) { + Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_driver->string, dlerror ()); return false; } #elif defined(_WIN32) - if (!(handle = LoadLibrary (gl_libgl->string))) { - Sys_Error ("Couldn't load OpenGL library %s!\n", gl_libgl->string); + if (!(handle = LoadLibrary (gl_driver->string))) { + Sys_Error ("Couldn't load OpenGL library %s!\n", gl_driver->string); return false; } #else diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index 768ba8e1e..37f595aaf 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -64,7 +64,7 @@ cvar_t *gl_fb_models; cvar_t *gl_fires; cvar_t *gl_keeptjunctions; cvar_t *gl_lerp_anim; -cvar_t *gl_libgl; +cvar_t *gl_driver; cvar_t *gl_lightmap_align; cvar_t *gl_lightmap_subimage; cvar_t *gl_max_size; @@ -193,8 +193,13 @@ R_Init_Cvars (void) "upon level load"); gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, NULL, "Toggles model animation interpolation"); - gl_libgl = Cvar_Get ("gl_libgl", "libGL.so.1", CVAR_ROM, NULL, - "The GL library to use. (path optional)"); + +#ifdef _WIN32 + gl_driver = Cvar_Get ("gl_driver", "OPENGL32.DLL", CVAR_ROM, NULL, +#else + gl_driver = Cvar_Get ("gl_driver", "libGL.so.1", CVAR_ROM, NULL, +#endif + "The OpenGL library to use. (path optional)"); gl_lightmap_align = Cvar_Get ("gl_lightmap_align", "1", CVAR_NONE, NULL, "Workaround for nvidia slow path. Set to 4 " "or 16 if you have an nvidia 3d " diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index 344fd0077..d398a8341 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -113,21 +113,17 @@ QFGL_ExtensionAddress (const char *name) { void *handle; static qboolean glProcAddress_present = true; -#if defined(HAVE_GLX) static QF_glXGetProcAddressARB glGetProcAddress = NULL; -#else - static void * (* glGetProcAddress) (const char *) = NULL; -#endif #if defined(HAVE_DLOPEN) - if (!(handle = dlopen (gl_libgl->string, RTLD_NOW))) { - Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_libgl->string, + if (!(handle = dlopen (gl_driver->string, RTLD_NOW))) { + Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_driver->string, dlerror ()); return 0; } #elif defined(_WIN32) - if (!(handle = LoadLibrary (gl_libgl->string))) { - Sys_Error ("Couldn't load OpenGL library %s!\n", gl_libgl->string); + if (!(handle = LoadLibrary (gl_driver->string))) { + Sys_Error ("Couldn't load OpenGL library %s!\n", gl_driver->string); return 0; } #else @@ -135,12 +131,10 @@ QFGL_ExtensionAddress (const char *name) #endif if (glProcAddress_present && !glGetProcAddress) { -#if defined(HAVE_GLX) - glGetProcAddress = - QFGL_ProcAddress (handle, "glXGetProcAddressARB", false); -#elif defined (_WIN32) - glGetProcAddress = - QFGL_ProcAddress (handle, "wglGetProcAddress", false); +#if defined (_WIN32) + glGetProcAddress = QFGL_ProcAddress (handle, "wglGetProcAddress", false); +#else + glGetProcAddress = QFGL_ProcAddress (handle, "glXGetProcAddressARB", false); #endif if (!glGetProcAddress) glProcAddress_present = false; diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 955e3dea2..aa4a19793 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -265,8 +265,8 @@ VID_Init (unsigned char *palette) GLint attribs[32]; #ifdef HAVE_DLOPEN - if (!(libgl_handle = dlopen (gl_libgl->string, RTLD_NOW))) { - Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_libgl->string, + if (!(libgl_handle = dlopen (gl_driver->string, RTLD_NOW))) { + Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_driver->string, dlerror()); return; } diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 735856785..32a7bf903 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -144,8 +144,8 @@ VID_Init (unsigned char *palette) }; #ifdef HAVE_DLOPEN - if (!(libgl_handle = dlopen (gl_libgl->string, RTLD_NOW))) { - Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_libgl->string, + if (!(libgl_handle = dlopen (gl_driver->string, RTLD_NOW))) { + Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_driver->string, dlerror()); return; } diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index 4e3a5c738..961233add 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -1138,8 +1138,8 @@ VID_Init (unsigned char *palette) HGLRC baseRC; DWORD lasterror; - if (!(libgl_handle = LoadLibrary (gl_libgl->string))) { - Sys_Error ("Can't open OpenGL library \"%s\"\n", gl_libgl->string); + if (!(libgl_handle = LoadLibrary (gl_driver->string))) { + Sys_Error ("Can't open OpenGL library \"%s\"\n", gl_driver->string); return; }