don't look up the gl functions until after the context has been setup, just

incase it affects which functions glGetProcAddress actually returns.
This commit is contained in:
Bill Currie 2004-02-06 00:58:35 +00:00
parent 3f91157b26
commit a45981bc6a
8 changed files with 17 additions and 22 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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) \

View file

@ -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);

View file

@ -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;

View file

@ -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",

View file

@ -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);

View file

@ -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);