View previous topic :: View next topic |
Author |
Message |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Wed Dec 02, 2009 10:42 am Post subject: Replacing SGIS in GLQuake |
|
|
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.
Code: | #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;
}
#endif |
glquake.h
Find
Code: | // Multitexture
#define TEXTURE0_SGIS 0x835E
#define TEXTURE1_SGIS 0x835F |
Replace with
Code: | // Multitexture
extern GLenum gl_oldtarget;
extern GLenum gl_Texture0;
extern GLenum gl_Texture1;
#define TEXTURE0_SGIS gl_Texture0
#define TEXTURE1_SGIS gl_Texture1 |
|
|
Back to top |
|
 |
Team Xlink
Joined: 25 Jun 2009 Posts: 320
|
Posted: Tue Dec 08, 2009 1:56 am Post subject: |
|
|
It seems sweet and simple.
But what exactly is SGSI? _________________
Anonymous wrote: | if it works, it works. if it doesn't, HAHAHA! |
|
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Dec 08, 2009 2:37 am Post subject: |
|
|
Team Xlink wrote: | It seems sweet and simple.
But what exactly is SGSI? |
The short fuzzy poorly explained version goes like this. SG = Silicon Graphics. In the 1990s an OpenGL extension was formalized under ARB ( http://www.opengl.org/about/arb/ ) and engines should be checking for that extension for multitexture instead of the old SGSI extension. So the above applies to OpenGL using engines (i.e. not the PSP, for example, and not DirectQ which uses Direct3D instead OpenGL or software renderers obviously). |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Wed Dec 09, 2009 3:59 am Post subject: |
|
|
uuuuh huh huh Silicon Graaphics uuuu huh huh huh
{pnsfw} _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Jun 22, 2010 12:23 pm Post subject: |
|
|
For reasons I can't quite understand, this implementation causes my Half-Life format textures to be all white.
The I tried r_lightmaps 1 and nothing!
So I loaded up aguirRe's Enhanced GLQuake engine only to discover his r_lightmaps 1 doesn't work either.
Kind of unexpected ... something "fun" to work through. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Jun 22, 2010 4:05 pm Post subject: |
|
|
What the wise person does is just remove SGIS altogether. OK, I can understand and appreciate the more cautious approach for sure, but in this case we're talking about an extension that's long since been superseded on everything aside from Voodoo 2 cards (I believe it may have even been superseded on Voodoo 2 - if anyone could pull an extensions list from a Voodoo 2 it would be great).
SGIS is crap, fundamentally. You can't use it with vertex arrays, you can't use it with combine modes, and who knows whether or not it's going to play nice if you try to use it with anything else.
It's not as if GL_ARB_multitexture is in any way new and therefore worthy of suspicion either. SGIS was deprecated back in the last century. Drop it already. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Tue Jun 22, 2010 4:26 pm Post subject: |
|
|
quake is the only thing that even uses the extension, that I'm aware of.
Just use a q2/q3 minidriver instead if your voodoo driver doesn't support arb. _________________ What's a signature? |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Tue Jun 22, 2010 9:09 pm Post subject: |
|
|
mh wrote: | if anyone could pull an extensions list from a Voodoo 2 it would be great |
GL_VENDOR: 3Dfx Interactive Inc.
GL_RENDERER: 3Dfx/Voodoo2/2 TMUs/4 MB/stand-alone (Jan 7 2000)
GL_VERSION: 1.1.0
GL_EXTENSIONS:
GL_ARB_multitexture GL_EXT_abgr GL_EXT_bgra GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_EXT_packed_pixels GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_shared_texture_palette GL_EXT_stencil_wrap GL_EXT_texture_env_add GL_EXT_vertex_array GL_SGIS_texture_edge_clamp GL_SGIS_multitexture WGL_3DFX_gamma_control WGL_EXT_swap_control _________________
 |
|
Back to top |
|
 |
|