rewrite QFGL_ExtensionAddress to just use QFGL_ProcAddress and be done with

it. hopefully this will fix raorn's crash.
This commit is contained in:
Bill Currie 2002-02-21 07:56:27 +00:00
parent 9bbcae0772
commit 972bd8852b

View file

@ -111,36 +111,27 @@ QFGL_ExtensionPresent (const char *name)
void * void *
QFGL_ExtensionAddress (const char *name) QFGL_ExtensionAddress (const char *name)
{ {
void *handle; static void *handle;
static qboolean glProcAddress_present = true;
static QF_glXGetProcAddressARB glGetProcAddress = NULL;
if (!handle) {
#if defined(HAVE_DLOPEN) #if defined(HAVE_DLOPEN)
if (!(handle = dlopen (gl_driver->string, RTLD_NOW))) { if (!(handle = dlopen (gl_driver->string, RTLD_NOW))) {
Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_driver->string, Sys_Error ("Couldn't load OpenGL library %s: %s\n",
dlerror ()); gl_driver->string, dlerror ());
return 0; return 0;
} }
#elif defined(_WIN32) #elif defined(_WIN32)
if (!(handle = LoadLibrary (gl_driver->string))) { if (!(handle = LoadLibrary (gl_driver->string))) {
Sys_Error ("Couldn't load OpenGL library %s!\n", gl_driver->string); Sys_Error ("Couldn't load OpenGL library %s!\n",
return 0; gl_driver->string);
} return 0;
}
#else #else
# error "Cannot load libraries: %s was not configured with DSO support" # error "Cannot load libraries: %s was not configured with DSO support"
#endif #endif
if (glProcAddress_present && !glGetProcAddress) {
#if defined (_WIN32)
glGetProcAddress = QFGL_ProcAddress (handle, "wglGetProcAddress", false);
#else
glGetProcAddress = QFGL_ProcAddress (handle, "glXGetProcAddressARB", false);
#endif
if (!glGetProcAddress)
glProcAddress_present = false;
} }
if (name && glProcAddress_present) if (name)
return glGetProcAddress (name); return QFGL_ProcAddress (handle, name, false);
return NULL; return NULL;
} }