Portability fixes, also use the new ProcAddress setup.

This commit is contained in:
Jeff Teunissen 2001-06-27 07:52:00 +00:00
parent aa7389e8b1
commit 06227cf37d

View file

@ -45,7 +45,9 @@
# include <X11/extensions/xf86dga.h> # include <X11/extensions/xf86dga.h>
#endif #endif
#ifdef HAVE_DLOPEN
# include <dlfcn.h> # include <dlfcn.h>
#endif
#include "QF/cmd.h" #include "QF/cmd.h"
#include "compat.h" #include "compat.h"
@ -170,35 +172,20 @@ VID_Init (unsigned char *palette)
None None
}; };
libgl_handle = dlopen (gl_libgl->string, RTLD_NOW); #ifdef HAVE_DLOPEN
if (!libgl_handle) { if (!(libgl_handle = dlopen (gl_libgl->string, RTLD_NOW))) {
Con_Printf("Can't open libgl %s: %s\n", gl_libgl->string, dlerror()); Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_libgl->string, dlerror());
return; return;
} }
#else
# error "No dynamic library support. FIXME."
#endif
glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers"); glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true);
if (!glXSwapBuffers) { glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true);
Sys_Error(va("Can't load symbol glXSwapBuffers: %s\n", dlerror())); glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", true);
return; glXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true);
} QFGL_ProcAddress (NULL, NULL, false); // make ProcAddress clear its cache
glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual");
if (!glXChooseVisual) {
Sys_Error(va("Can't load symbol glXChooseVisual: %s\n", dlerror()));
return;
}
glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext");
if (!glXCreateContext) {
Sys_Error(va("Can't load symbol glXCreateContext: %s\n", dlerror()));
return;
}
glXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent");
if (!glXMakeCurrent) {
Sys_Error(va("Can't load symbol glXMakeCurrent: %s\n", dlerror()));
return;
}
Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the quake window in a virtual desktop.\n"); Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the quake window in a virtual desktop.\n");