Replacing SGIS in GLQuake
Posted: Wed Dec 02, 2009 10:42 am
Not a very interesting tutorial, but I'm doing this for MH's Direct3D 8.1 wrapper and I want to remember precisely what needed to be done. This is replacing a very old multitexturing API extension with the ARB extension (but retaining backwards compatibility with aguirRe's way).
Using aguirRe's Enhanced GLQuake as the role model here ...
Files to examine: gl_draw.c gl_rsurf.c gl_vidnt.c glquake.h
gldraw.c
GL_LoadPicTexture:
static GLenum oldtarget = TEXTURE0_SGIS; --> GLenum gl_oldtarget;
Rename oldtarget occurances to gl_oldtarget
gl_vidnt.c
Steal aguirRe's CheckMultitextureExtensions outright, replacing the existing function.
glquake.h
Find
Replace with
Using aguirRe's Enhanced GLQuake as the role model here ...
Files to examine: gl_draw.c gl_rsurf.c gl_vidnt.c glquake.h
gldraw.c
GL_LoadPicTexture:
static GLenum oldtarget = TEXTURE0_SGIS; --> GLenum gl_oldtarget;
Rename oldtarget occurances to gl_oldtarget
gl_vidnt.c
Steal aguirRe's CheckMultitextureExtensions outright, replacing the existing function.
Code: Select all
#ifdef _WIN32
void CheckMultiTextureExtensions(void)
{
qboolean SGIS, ARB;
if (COM_CheckParm("-nomtex"))
{
Con_Printf ("WARNING: Multitexture disabled at command line\n");
return;
}
if (COM_CheckParm("-nomtexarb"))
ARB = false;
else
ARB = strstr (gl_extensions, "GL_ARB_multitexture ") != NULL;
SGIS = strstr (gl_extensions, "GL_SGIS_multitexture ") != NULL;
if (ARB || SGIS)
{
Con_Printf ("GL_%s_multitexture extensions found\n", ARB ? "ARB" : "SGIS");
qglMTexCoord2fSGIS = (void *) wglGetProcAddress (ARB ? "glMultiTexCoord2fARB" : "glMTexCoord2fSGIS");
qglSelectTextureSGIS = (void *) wglGetProcAddress (ARB ? "glActiveTextureARB" : "glSelectTextureSGIS");
TEXTURE0_SGIS = ARB ? 0x84C0 : 0x835E;
TEXTURE1_SGIS = ARB ? 0x84C1 : 0x835F;
gl_oldtarget = TEXTURE0_SGIS;
gl_mtexable = true;
}
else
Con_Printf ("WARNING: Multitexture not supported\n");
}
#else
void CheckMultiTextureExtensions(void)
{
gl_mtexable = true;
}
#endifFind
Code: Select all
// Multitexture
#define TEXTURE0_SGIS 0x835E
#define TEXTURE1_SGIS 0x835FCode: Select all
// Multitexture
extern GLenum gl_oldtarget;
extern GLenum gl_Texture0;
extern GLenum gl_Texture1;
#define TEXTURE0_SGIS gl_Texture0
#define TEXTURE1_SGIS gl_Texture1