From: lordhavoc Date: Tue, 14 May 2002 10:43:25 +0000 (+0000) Subject: search for GL functions using GetProcAddress on win32 instead of wglGetProcAddress... X-Git-Tag: RELEASE_0_2_0_RC1~518 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9937a055e2478c1089fc97c0b8417c83ca39b211;p=xonotic%2Fdarkplaces.git search for GL functions using GetProcAddress on win32 instead of wglGetProcAddress (which only lists extensions, apparently), fixes inability to find GL 1.1.0 functions in 3dfx driver (maybe NVIDIA and others, only tested 3dfx) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1830 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_shared.c b/vid_shared.c index 4f004218..c0b9fba8 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -230,13 +230,17 @@ static gl_extensionfunctionlist_t compiledvertexarrayfuncs[] = #include #endif -#ifndef WIN32 +#ifdef WIN32 +static HINSTANCE gldll; +#else static void *prjobj = NULL; #endif static void gl_getfuncs_begin(void) { -#ifndef WIN32 +#ifdef WIN32 + gldll = LoadLibrary("opengl32.dll"); +#else if (prjobj) dlclose(prjobj); @@ -251,19 +255,20 @@ static void gl_getfuncs_begin(void) static void gl_getfuncs_end(void) { -#ifndef WIN32 +#ifdef WIN32 + FreeLibrary(gldll); +#else if (prjobj) - { dlclose(prjobj); - prjobj = NULL; - } + prjobj = NULL; #endif } static void *gl_getfuncaddress(char *name) { #ifdef WIN32 - return (void *) wglGetProcAddress(name); +// return (void *) wglGetProcAddress(name); + return (void *) GetProcAddress(gldll, name); #else return (void *) dlsym(prjobj, name); #endif @@ -271,6 +276,7 @@ static void *gl_getfuncaddress(char *name) static int gl_checkextension(char *name, gl_extensionfunctionlist_t *funcs, char *disableparm) { + int failed = false; gl_extensionfunctionlist_t *func; Con_Printf("checking for %s... ", name); @@ -291,9 +297,12 @@ static int gl_checkextension(char *name, gl_extensionfunctionlist_t *funcs, char if (!(*func->funcvariable = (void *) gl_getfuncaddress(func->name))) { Con_Printf("missing function \"%s\"!\n", func->name); - return false; + failed = true; } } + // delay the return so it prints all missing functions + if (failed) + return false; Con_Printf("enabled\n"); return true; }