From 6d773c54a584900ed677eb428cc5465e69e9fe70 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 2 Nov 2014 01:11:37 -0500 Subject: [PATCH] Use OpenGL 1.3 in static builds and on SDL interfaces --- src/hardware/r_opengl/ogl_win.c | 3 --- src/hardware/r_opengl/r_opengl.c | 24 +++++++++++------------- src/sdl/ogl_sdl.c | 2 ++ src/sdl12/ogl_sdl.c | 2 ++ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/hardware/r_opengl/ogl_win.c b/src/hardware/r_opengl/ogl_win.c index bfdc96d6a..5cc075cea 100644 --- a/src/hardware/r_opengl/ogl_win.c +++ b/src/hardware/r_opengl/ogl_win.c @@ -366,10 +366,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode) else maximumAnisotropy = 0; -#ifndef MINI_GL_COMPATIBILITY SetupGLFunc13(); -#endif - screen_depth = (GLbyte)(lvid->bpp*8); if (screen_depth > 16) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c136d0634..0f0f7e014 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -517,18 +517,15 @@ boolean SetupGLfunc(void) return true; } -#ifndef MINI_GL_COMPATIBILITY // This has to be done after the context is created so the version number can be obtained boolean SetupGLFunc13(void) { -#ifndef STATIC_OPENGL -#define GETOPENGLFUNC(func, proc) \ - func = GetGLFunc(#proc); \ - if (!func) \ - { \ - DBG_Printf("failed to get OpenGL function: %s", #proc); \ - } \ - +#ifdef MINI_GL_COMPATIBILITY + return false; +#else +#ifdef STATIC_OPENGL + gl13 = true; +#else const char *glversion = (const char *)pglGetString(GL_VERSION); UINT32 majorversion = 0, minorversion = 0; @@ -537,18 +534,19 @@ boolean SetupGLFunc13(void) if (majorversion > 1 || (majorversion == 1 && minorversion >= 3)) // Version of OpenGL is equal to or greater than 1.3 { // Get the functions - GETOPENGLFUNC(pglActiveTexture , glActiveTexture) - GETOPENGLFUNC(pglMultiTexCoord2f , glMultiTexCoord2f) + pglActiveTexture = GetGLFunc("glActiveTexture"); + pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f"); - gl13 = true; // This is now true, so the new fade mask stuff can be done, if OpenGL version is less than 1.3, it still uses the old fade stuff. + if (pglMultiTexCoord2f) + gl13 = true; // This is now true, so the new fade mask stuff can be done, if OpenGL version is less than 1.3, it still uses the old fade stuff. } } #undef GETOPENGLFUNC #endif return true; -} #endif +} // -----------------+ // SetNoTexture : Disable texture diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 62055e104..6cbecaf3c 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -176,6 +176,8 @@ boolean OglSdlSurface(INT32 w, INT32 h) else maximumAnisotropy = 1; + SetupGLFunc13(); + granisotropicmode_cons_t[1].value = maximumAnisotropy; SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); diff --git a/src/sdl12/ogl_sdl.c b/src/sdl12/ogl_sdl.c index e726bf07d..eb7e9996d 100644 --- a/src/sdl12/ogl_sdl.c +++ b/src/sdl12/ogl_sdl.c @@ -237,6 +237,8 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) #endif maximumAnisotropy = 0; + SetupGLFunc13(); + granisotropicmode_cons_t[1].value = maximumAnisotropy; SetModelView(w, h);