mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
hopefully take care of glGetProcAddress type once and for all :)
This commit is contained in:
parent
a4fa9da4f1
commit
4b1ceb9795
6 changed files with 52 additions and 45 deletions
|
@ -44,15 +44,9 @@
|
|||
extern void *libgl_handle;
|
||||
|
||||
qboolean GLF_Init (void);
|
||||
void *QFGL_ProcAddress (void *, const char *, qboolean);
|
||||
void *QFGL_ProcAddress (void *handle, const char *name, qboolean);
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void *(WINAPI *glGetProcAddress) (const char *);
|
||||
extern FARPROC (WINAPI *getProcAddress) (HINSTANCE, LPCSTR);
|
||||
#else
|
||||
extern void *(*glGetProcAddress) (const char *);
|
||||
extern void *(*getProcAddress) (void *, const char *);
|
||||
#endif
|
||||
extern void *QFGL_LoadLibrary (void);
|
||||
void *QFGL_LoadLibrary (void);
|
||||
void *QFGL_GetProcAddress (void *handle, const char *name);
|
||||
|
||||
#endif // __QF_GL_funcs_h_
|
||||
|
|
|
@ -73,10 +73,7 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
|
|||
|
||||
Con_DPrintf ("DEBUG: Finding symbol %s ... ", name);
|
||||
|
||||
if (glGetProcAddress)
|
||||
glfunc = glGetProcAddress (name);
|
||||
if (!glfunc)
|
||||
glfunc = getProcAddress (handle, name);
|
||||
glfunc = QFGL_GetProcAddress (handle, name);
|
||||
if (glfunc) {
|
||||
Con_DPrintf ("found [%p]\n", glfunc);
|
||||
return glfunc;
|
||||
|
|
|
@ -113,7 +113,18 @@ int VID_options_items = 0;
|
|||
#if defined(HAVE_DLOPEN)
|
||||
|
||||
void * (* glGetProcAddress) (const char *symbol)= NULL;
|
||||
void * (* getProcAddress) (void *handle, const char *symbol);
|
||||
|
||||
void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
if (glGetProcAddress)
|
||||
glfunc = glGetProcAddress (name);
|
||||
if (!glfunc)
|
||||
glfunc = dlsym (handle, name);
|
||||
return glfunc;
|
||||
}
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
|
@ -124,7 +135,6 @@ QFGL_LoadLibrary (void)
|
|||
Sys_Error ("Couldn't load OpenGL library %s: %s", gl_driver->string,
|
||||
dlerror ());
|
||||
}
|
||||
getProcAddress = dlsym;
|
||||
glGetProcAddress = dlsym (handle, "glXGetProcAddressARB");
|
||||
return handle;
|
||||
}
|
||||
|
@ -133,7 +143,11 @@ QFGL_LoadLibrary (void)
|
|||
# error "Cannot load libraries: %s was not configured with DSO support"
|
||||
|
||||
// the following is to avoid other compiler errors
|
||||
void * (* getProcAddress) (void *handle, const char *symbol);
|
||||
void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
|
|
|
@ -94,7 +94,18 @@ Bool (* qfglXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
|||
#if defined(HAVE_DLOPEN)
|
||||
|
||||
void * (* glGetProcAddress) (const char *symbol) = NULL;
|
||||
void * (* getProcAddress) (void *handle, const char *symbol);
|
||||
|
||||
void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
if (glGetProcAddress)
|
||||
glfunc = glGetProcAddress (name);
|
||||
if (!glfunc)
|
||||
glfunc = dlsym (handle, name);
|
||||
return glfunc;
|
||||
}
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
|
@ -105,7 +116,6 @@ QFGL_LoadLibrary (void)
|
|||
Sys_Error ("Couldn't load OpenGL library %s: %s", gl_driver->string,
|
||||
dlerror ());
|
||||
}
|
||||
getProcAddress = dlsym;
|
||||
glGetProcAddress = dlsym (handle, "glXGetProcAddressARB");
|
||||
return handle;
|
||||
}
|
||||
|
@ -114,7 +124,11 @@ QFGL_LoadLibrary (void)
|
|||
# error "Cannot load libraries: %s was not configured with DSO support"
|
||||
|
||||
// the following is to avoid other compiler errors
|
||||
void * (* getProcAddress) (void *handle, const char *symbol);
|
||||
void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
|
|
|
@ -70,14 +70,10 @@ int modestate;
|
|||
|
||||
static SDL_Surface *screen = NULL;
|
||||
|
||||
void * (* glGetProcAddress) (const char *symbol) = NULL;
|
||||
void * (* getProcAddress) (void *, const char *);
|
||||
|
||||
|
||||
void *
|
||||
QFGL_DummyProcAddress (void *handle, const char *symbol)
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
return NULL;
|
||||
return SDL_GL_GetProcAddress (name);
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -86,9 +82,6 @@ QFGL_LoadLibrary (void)
|
|||
if (SDL_GL_LoadLibrary (gl_driver->string) != 0)
|
||||
Sys_Error ("Couldn't load OpenGL library %s!", gl_driver->string);
|
||||
|
||||
getProcAddress = QFGL_DummyProcAddress;
|
||||
glGetProcAddress = SDL_GL_GetProcAddress;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,10 +139,19 @@ void VID_UpdateWindowStatus (int window_x, int window_y);
|
|||
void GL_Init (void);
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
void * (WINAPI *glGetProcAddress) (const char *symbol) = NULL;
|
||||
FARPROC (WINAPI *getProcAddress) (HINSTANCE, LPCSTR);
|
||||
|
||||
void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
if (glGetProcAddress)
|
||||
glfunc = glGetProcAddress (name);
|
||||
if (!glfunc)
|
||||
glfunc = GetProcAddress (handle, name);
|
||||
return glfunc;
|
||||
}
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
|
@ -151,23 +160,9 @@ QFGL_LoadLibrary (void)
|
|||
|
||||
if (!(handle = LoadLibrary (gl_driver->string)))
|
||||
Sys_Error ("Couldn't load OpenGL library %s!", gl_driver->string);
|
||||
getProcAddress = GetProcAddress;
|
||||
(FARPROC)glGetProcAddress = GetProcAddress (handle, "wglGetProcAddress");
|
||||
return handle;
|
||||
}
|
||||
#else
|
||||
|
||||
# error "Cannot load libraries: %s was not configured with DSO support"
|
||||
|
||||
// the following is to avoid other compiler errors
|
||||
void * (* getProcAddress) (void *handle, const char *symbol);
|
||||
|
||||
void *
|
||||
QFGL_LoadLibrary (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
//====================================
|
||||
|
|
Loading…
Reference in a new issue