From: molivier Date: Thu, 31 Mar 2005 05:41:44 +0000 (+0000) Subject: Removed GL_OpenLibrary and GL_CloseLibrary from "vid.h" and "vid_null.c" X-Git-Tag: xonotic-v0.1.0preview~5039 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=08cfbcc087c853e657a505fd4dc985539921650c;p=xonotic%2Fdarkplaces.git Removed GL_OpenLibrary and GL_CloseLibrary from "vid.h" and "vid_null.c" git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5134 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid.h b/vid.h index dbaa81aa..e845edd6 100644 --- a/vid.h +++ b/vid.h @@ -96,8 +96,6 @@ extern qboolean isRagePro; // LordHavoc: GLX_SGI_swap_control and WGL_EXT_swap_control extern int gl_videosyncavailable; -int GL_OpenLibrary(const char *name); -void GL_CloseLibrary(void); void *GL_GetProcAddress(const char *name); int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *disableparm, int silent); diff --git a/vid_glx.c b/vid_glx.c index 70336a9c..aa86a167 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -551,6 +551,43 @@ static void IN_ActivateMouse( void ) } } +static void *prjobj = NULL; + +static void GL_CloseLibrary(void) +{ + if (prjobj) + dlclose(prjobj); + prjobj = NULL; + gl_driver[0] = 0; + qglXGetProcAddressARB = NULL; + gl_extensions = ""; + gl_platform = ""; + gl_platformextensions = ""; +} + +static int GL_OpenLibrary(const char *name) +{ + Con_Printf("Loading OpenGL driver %s\n", name); + GL_CloseLibrary(); + if (!(prjobj = dlopen(name, RTLD_LAZY))) + { + Con_Printf("Unable to open symbol list for %s\n", name); + return false; + } + strcpy(gl_driver, name); + return true; +} + +void *GL_GetProcAddress(const char *name) +{ + void *p = NULL; + if (qglXGetProcAddressARB != NULL) + p = (void *) qglXGetProcAddressARB(name); + if (p == NULL) + p = (void *) dlsym(prjobj, name); + return p; +} + void VID_Shutdown(void) { if (!ctx || !vidx11_display) @@ -907,41 +944,3 @@ void IN_Move (void) mouse_x = 0; mouse_y = 0; } - -static void *prjobj = NULL; - -int GL_OpenLibrary(const char *name) -{ - Con_Printf("Loading OpenGL driver %s\n", name); - GL_CloseLibrary(); - if (!(prjobj = dlopen(name, RTLD_LAZY))) - { - Con_Printf("Unable to open symbol list for %s\n", name); - return false; - } - strcpy(gl_driver, name); - return true; -} - -void GL_CloseLibrary(void) -{ - if (prjobj) - dlclose(prjobj); - prjobj = NULL; - gl_driver[0] = 0; - qglXGetProcAddressARB = NULL; - gl_extensions = ""; - gl_platform = ""; - gl_platformextensions = ""; -} - -void *GL_GetProcAddress(const char *name) -{ - void *p = NULL; - if (qglXGetProcAddressARB != NULL) - p = (void *) qglXGetProcAddressARB(name); - if (p == NULL) - p = (void *) dlsym(prjobj, name); - return p; -} - diff --git a/vid_null.c b/vid_null.c index 7daea1e5..19af599e 100644 --- a/vid_null.c +++ b/vid_null.c @@ -80,15 +80,6 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) return false; } -int GL_OpenLibrary(const char *name) -{ - return false; -} - -void GL_CloseLibrary(void) -{ -} - void *GL_GetProcAddress(const char *name) { return NULL; diff --git a/vid_wgl.c b/vid_wgl.c index 1595e798..b76da3d6 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -693,7 +693,18 @@ int VID_GetGamma(unsigned short *ramps) static HINSTANCE gldll; -int GL_OpenLibrary(const char *name) +static void GL_CloseLibrary(void) +{ + FreeLibrary(gldll); + gldll = 0; + gl_driver[0] = 0; + qwglGetProcAddress = NULL; + gl_extensions = ""; + gl_platform = ""; + gl_platformextensions = ""; +} + +static int GL_OpenLibrary(const char *name) { Con_Printf("Loading OpenGL driver %s\n", name); GL_CloseLibrary(); @@ -706,17 +717,6 @@ int GL_OpenLibrary(const char *name) return true; } -void GL_CloseLibrary(void) -{ - FreeLibrary(gldll); - gldll = 0; - gl_driver[0] = 0; - qwglGetProcAddress = NULL; - gl_extensions = ""; - gl_platform = ""; - gl_platformextensions = ""; -} - void *GL_GetProcAddress(const char *name) { void *p = NULL;