diff --git a/include/QF/GL/funcs.h b/include/QF/GL/funcs.h index 474c2b691..485294f69 100644 --- a/include/QF/GL/funcs.h +++ b/include/QF/GL/funcs.h @@ -46,6 +46,7 @@ extern void *libgl_handle; qboolean GLF_Init (void); +qboolean GLF_FindFunctions (void); void *QFGL_ProcAddress (void *handle, const char *name, qboolean); void *QFGL_LoadLibrary (void); diff --git a/include/QF/vid.h b/include/QF/vid.h index ca0aaddc6..6f7292b97 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -134,7 +134,6 @@ qboolean VID_SetGamma (double); void VID_UpdateGamma (struct cvar_s *); void GL_Init_Common (void); -void GL_Pre_Init (void); void VID_MakeColormaps (int fullbrights, byte *pal); diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index 60c8f42db..f61cd4ed7 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -108,7 +108,12 @@ qboolean GLF_Init (void) { libgl_handle = QFGL_LoadLibrary (); + return true; +} +qboolean +GLF_FindFunctions (void) +{ #define QFGL_WANT(ret, name, args) \ qf##name = QFGL_ProcAddress (libgl_handle, #name, false); #define QFGL_NEED(ret, name, args) \ diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 4d765aa60..8a7f50596 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -274,7 +274,7 @@ VID_Init (unsigned char *palette) int i; GLint attribs[32]; - GL_Pre_Init (); + GLF_Init (); qf_fxMesaCreateContext = QFGL_ProcAddress (libgl_handle, "fxMesaCreateContext", true); diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index 9a4a12f39..aebf66e57 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -319,18 +319,10 @@ VID_SetPalette (unsigned char *palette) } } -void -GL_Pre_Init (void) -{ - if (!GLF_Init()) { - Sys_Error ("Can't init video."); - return; - } -} - void GL_Init_Common (void) { + GLF_FindFunctions (); gl_version = qfglGetString (GL_VERSION); if (sscanf (gl_version, "%d.%d", &gl_major, &gl_minor) == 2) { gl_release_number = 0; diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 396e176c5..a90832858 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -83,16 +83,16 @@ typedef struct __GLXcontextRec *GLXContext; static GLXContext ctx = NULL; typedef XID GLXDrawable; -void (* qfglXSwapBuffers) (Display *dpy, GLXDrawable drawable); -XVisualInfo* (* qfglXChooseVisual) (Display *dpy, int screen, int *attribList); -GLXContext (* qfglXCreateContext) (Display *dpy, XVisualInfo *vis, - GLXContext shareList, Bool direct); -Bool (* qfglXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx); +void (*qfglXSwapBuffers) (Display *dpy, GLXDrawable drawable); +XVisualInfo* (*qfglXChooseVisual) (Display *dpy, int screen, int *attribList); +GLXContext (*qfglXCreateContext) (Display *dpy, XVisualInfo *vis, + GLXContext shareList, Bool direct); +Bool (*qfglXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx); // ============================================================================ -static int use_gl_procaddress = 1; +static int use_gl_procaddress = 0; #if defined(HAVE_DLOPEN) @@ -188,9 +188,7 @@ VID_Init (unsigned char *palette) None }; - GL_Pre_Init (); - - use_gl_procaddress = 0; + GLF_Init (); qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index 7495feae1..21def4a13 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -108,7 +108,7 @@ VID_Init (unsigned char *palette) if (SDL_Init (SDL_INIT_VIDEO) < 0) Sys_Error ("Couldn't initialize SDL: %s", SDL_GetError ()); - GL_Pre_Init (); + GLF_Init (); VID_GetWindowSize (640, 480); diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index abecdf865..4a01f86a0 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -460,7 +460,7 @@ VID_Init (unsigned char *palette) vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM | CVAR_ARCHIVE, NULL, "Run WGL client at fullscreen"); - GL_Pre_Init (); + GLF_Init (); qf_wglCreateContext = QFGL_ProcAddress (libgl_handle, "wglCreateContext", true);