Den Multitexture-Krams raus. Das wurde von Icculus reingefrickelt und

funktionierte eh nie wirklich. Sprich, war mit -DBROKENGL abgeschaltet
This commit is contained in:
Yamagi Burmeister 2009-10-04 10:27:55 +00:00
parent 1538852650
commit 4b896d104e
5 changed files with 18 additions and 389 deletions

View file

@ -67,61 +67,6 @@ void GL_SetTexturePalette( unsigned palette[256] )
}
}
void GL_EnableMultitexture( qboolean enable )
{
if ( !qglSelectTextureSGIS && !qglActiveTextureARB )
return;
if ( enable )
{
GL_SelectTexture( QGL_TEXTURE1 );
qglEnable( GL_TEXTURE_2D );
GL_TexEnv( GL_REPLACE );
}
else
{
GL_SelectTexture( QGL_TEXTURE1 );
qglDisable( GL_TEXTURE_2D );
GL_TexEnv( GL_REPLACE );
}
GL_SelectTexture( QGL_TEXTURE0 );
GL_TexEnv( GL_REPLACE );
}
void GL_SelectTexture( GLenum texture )
{
int tmu;
if ( !qglSelectTextureSGIS && !qglActiveTextureARB )
return;
if ( texture == QGL_TEXTURE0 )
{
tmu = 0;
}
else
{
tmu = 1;
}
if ( tmu == gl_state.currenttmu )
{
return;
}
gl_state.currenttmu = tmu;
if ( qglSelectTextureSGIS )
{
qglSelectTextureSGIS( texture );
}
else if ( qglActiveTextureARB )
{
qglActiveTextureARB( texture );
qglClientActiveTextureARB( texture );
}
}
void GL_TexEnv( GLenum mode )
{
static int lastmodes[2] = { -1, -1 };
@ -147,7 +92,6 @@ void GL_Bind (int texnum)
void GL_MBind( GLenum target, int texnum )
{
GL_SelectTexture( target );
if ( target == QGL_TEXTURE0 )
{
if ( gl_state.currenttextures[0] == texnum )

View file

@ -1213,55 +1213,6 @@ int R_Init( void *hinstance, void *hWnd )
ri.Con_Printf( PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n" );
}
if ( strstr( gl_config.extensions_string, "GL_ARB_multitexture" ) )
{
#ifndef BROKEN_GL
if ( gl_ext_multitexture->value )
{
ri.Con_Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" );
qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMultiTexCoord2fARB" );
qglActiveTextureARB = ( void * ) qwglGetProcAddress( "glActiveTextureARB" );
qglClientActiveTextureARB = ( void * ) qwglGetProcAddress( "glClientActiveTextureARB" );
QGL_TEXTURE0 = GL_TEXTURE0_ARB;
QGL_TEXTURE1 = GL_TEXTURE1_ARB;
}
else
{
ri.Con_Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" );
}
#else
ri.Con_Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" );
#endif
}
else
{
ri.Con_Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" );
}
if ( strstr( gl_config.extensions_string, "GL_SGIS_multitexture" ) )
{
if ( qglActiveTextureARB )
{
ri.Con_Printf( PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n" );
}
else if ( gl_ext_multitexture->value )
{
ri.Con_Printf( PRINT_ALL, "...using GL_SGIS_multitexture\n" );
qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMTexCoord2fSGIS" );
qglSelectTextureSGIS = ( void * ) qwglGetProcAddress( "glSelectTextureSGIS" );
QGL_TEXTURE0 = GL_TEXTURE0_SGIS;
QGL_TEXTURE1 = GL_TEXTURE1_SGIS;
}
else
{
ri.Con_Printf( PRINT_ALL, "...ignoring GL_SGIS_multitexture\n" );
}
}
else
{
ri.Con_Printf( PRINT_ALL, "...GL_SGIS_multitexture not found\n" );
}
GL_SetDefaultState();
GL_InitImages ();

View file

@ -571,235 +571,24 @@ void DrawTextureChains (void)
c_visible_textures = 0;
if ( !qglSelectTextureSGIS && !qglActiveTextureARB )
for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
{
for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
{
if (!image->registration_sequence)
continue;
s = image->texturechain;
if (!s)
continue;
c_visible_textures++;
if (!image->registration_sequence)
continue;
s = image->texturechain;
if (!s)
continue;
c_visible_textures++;
for ( ; s ; s=s->texturechain)
R_RenderBrushPoly (s);
for ( ; s ; s=s->texturechain)
R_RenderBrushPoly (s);
image->texturechain = NULL;
}
}
else
{
for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
{
if (!image->registration_sequence)
continue;
if (!image->texturechain)
continue;
c_visible_textures++;
for ( s = image->texturechain; s ; s=s->texturechain)
{
if ( !( s->flags & SURF_DRAWTURB ) )
R_RenderBrushPoly (s);
}
}
GL_EnableMultitexture( false );
for ( i = 0, image=gltextures ; i<numgltextures ; i++,image++)
{
if (!image->registration_sequence)
continue;
s = image->texturechain;
if (!s)
continue;
for ( ; s ; s=s->texturechain)
{
if ( s->flags & SURF_DRAWTURB )
R_RenderBrushPoly (s);
}
image->texturechain = NULL;
}
image->texturechain = NULL;
}
GL_TexEnv( GL_REPLACE );
}
static void GL_RenderLightmappedPoly( msurface_t *surf )
{
int i, nv = surf->polys->numverts;
int map;
float *v;
image_t *image = R_TextureAnimation( surf->texinfo );
qboolean is_dynamic = false;
unsigned lmtex = surf->lightmaptexturenum;
glpoly_t *p;
for ( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
{
if ( r_newrefdef.lightstyles[surf->styles[map]].white != surf->cached_light[map] )
goto dynamic;
}
// dynamic this frame or dynamic previously
if ( ( surf->dlightframe == r_framecount ) )
{
dynamic:
if ( gl_dynamic->value )
{
if ( !(surf->texinfo->flags & (SURF_SKY|SURF_TRANS33|SURF_TRANS66|SURF_WARP ) ) )
{
is_dynamic = true;
}
}
}
if ( is_dynamic )
{
unsigned temp[128*128];
int smax, tmax;
if ( ( surf->styles[map] >= 32 || surf->styles[map] == 0 ) && ( surf->dlightframe != r_framecount ) )
{
smax = (surf->extents[0]>>4)+1;
tmax = (surf->extents[1]>>4)+1;
R_BuildLightMap( surf, (void *)temp, smax*4 );
R_SetCacheState( surf );
GL_MBind( QGL_TEXTURE1, gl_state.lightmap_textures + surf->lightmaptexturenum );
lmtex = surf->lightmaptexturenum;
qglTexSubImage2D( GL_TEXTURE_2D, 0,
surf->light_s, surf->light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
GL_UNSIGNED_BYTE, temp );
}
else
{
smax = (surf->extents[0]>>4)+1;
tmax = (surf->extents[1]>>4)+1;
R_BuildLightMap( surf, (void *)temp, smax*4 );
GL_MBind( QGL_TEXTURE1, gl_state.lightmap_textures + 0 );
lmtex = 0;
qglTexSubImage2D( GL_TEXTURE_2D, 0,
surf->light_s, surf->light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
GL_UNSIGNED_BYTE, temp );
}
c_brush_polys++;
GL_MBind( QGL_TEXTURE0, image->texnum );
GL_MBind( QGL_TEXTURE1, gl_state.lightmap_textures + lmtex );
//==========
//PGM
if (surf->texinfo->flags & SURF_FLOWING)
{
float scroll;
scroll = -64 * ( (r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0) );
if(scroll == 0.0)
scroll = -64.0;
for ( p = surf->polys; p; p = p->chain )
{
v = p->verts[0];
qglBegin (GL_POLYGON);
for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
{
qglMTexCoord2fSGIS( QGL_TEXTURE0, (v[3]+scroll), v[4]);
qglMTexCoord2fSGIS( QGL_TEXTURE1, v[5], v[6]);
qglVertex3fv (v);
}
qglEnd ();
}
}
else
{
for ( p = surf->polys; p; p = p->chain )
{
v = p->verts[0];
qglBegin (GL_POLYGON);
for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
{
qglMTexCoord2fSGIS( QGL_TEXTURE0, v[3], v[4]);
qglMTexCoord2fSGIS( QGL_TEXTURE1, v[5], v[6]);
qglVertex3fv (v);
}
qglEnd ();
}
}
//PGM
//==========
}
else
{
c_brush_polys++;
GL_MBind( QGL_TEXTURE0, image->texnum );
GL_MBind( QGL_TEXTURE1, gl_state.lightmap_textures + lmtex );
//==========
//PGM
if (surf->texinfo->flags & SURF_FLOWING)
{
float scroll;
scroll = -64 * ( (r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0) );
if(scroll == 0.0)
scroll = -64.0;
for ( p = surf->polys; p; p = p->chain )
{
v = p->verts[0];
qglBegin (GL_POLYGON);
for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
{
qglMTexCoord2fSGIS( QGL_TEXTURE0, (v[3]+scroll), v[4]);
qglMTexCoord2fSGIS( QGL_TEXTURE1, v[5], v[6]);
qglVertex3fv (v);
}
qglEnd ();
}
}
else
{
//PGM
//==========
for ( p = surf->polys; p; p = p->chain )
{
v = p->verts[0];
qglBegin (GL_POLYGON);
for (i=0 ; i< nv; i++, v+= VERTEXSIZE)
{
qglMTexCoord2fSGIS( QGL_TEXTURE0, v[3], v[4]);
qglMTexCoord2fSGIS( QGL_TEXTURE1, v[5], v[6]);
qglVertex3fv (v);
}
qglEnd ();
}
//==========
//PGM
}
//PGM
//==========
}
}
/*
=================
R_DrawInlineBModel
@ -851,23 +640,16 @@ void R_DrawInlineBModel (void)
psurf->texturechain = r_alpha_surfaces;
r_alpha_surfaces = psurf;
}
else if ( qglMTexCoord2fSGIS && !( psurf->flags & SURF_DRAWTURB ) )
{
GL_RenderLightmappedPoly( psurf );
}
else
{
GL_EnableMultitexture( false );
R_RenderBrushPoly( psurf );
GL_EnableMultitexture( true );
}
}
}
if ( !(currententity->flags & RF_TRANSLUCENT) )
{
if ( !qglMTexCoord2fSGIS )
R_BlendLightmaps ();
R_BlendLightmaps ();
}
else
{
@ -936,14 +718,10 @@ void R_DrawBrushModel (entity_t *e)
e->angles[0] = -e->angles[0]; // stupid quake bug
e->angles[2] = -e->angles[2]; // stupid quake bug
GL_EnableMultitexture( true );
GL_SelectTexture( QGL_TEXTURE0);
GL_TexEnv( GL_REPLACE );
GL_SelectTexture( QGL_TEXTURE1);
GL_TexEnv( GL_MODULATE );
R_DrawInlineBModel ();
GL_EnableMultitexture( false );
qglPopMatrix ();
}
@ -1059,19 +837,12 @@ void R_RecursiveWorldNode (mnode_t *node)
}
else
{
if ( qglMTexCoord2fSGIS && !( surf->flags & SURF_DRAWTURB ) )
{
GL_RenderLightmappedPoly( surf );
}
else
{
// the polygon is visible, so add it to the texture
// sorted chain
// FIXME: this is a hack for animation
image = R_TextureAnimation (surf->texinfo);
surf->texturechain = image->texturechain;
image->texturechain = surf;
}
// the polygon is visible, so add it to the texture
// sorted chain
// FIXME: this is a hack for animation
image = R_TextureAnimation (surf->texinfo);
surf->texturechain = image->texturechain;
image->texturechain = surf;
}
}
@ -1109,33 +880,8 @@ void R_DrawWorld (void)
qglColor3f (1,1,1);
memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
R_ClearSkyBox ();
R_RecursiveWorldNode (r_worldmodel->nodes);
if ( qglMTexCoord2fSGIS )
{
GL_EnableMultitexture( true );
GL_SelectTexture( QGL_TEXTURE0);
GL_TexEnv( GL_REPLACE );
GL_SelectTexture( QGL_TEXTURE1);
if ( gl_lightmap->value )
GL_TexEnv( GL_REPLACE );
else
GL_TexEnv( GL_MODULATE );
R_RecursiveWorldNode (r_worldmodel->nodes);
GL_EnableMultitexture( false );
}
else
{
R_RecursiveWorldNode (r_worldmodel->nodes);
}
/*
** theoretically nothing should happen in the next two functions
** if multitexture is enabled
*/
DrawTextureChains ();
R_BlendLightmaps ();
@ -1446,9 +1192,6 @@ void GL_BeginBuildingLightmaps (model_t *m)
r_framecount = 1; // no dlightcache
GL_EnableMultitexture( true );
GL_SelectTexture( QGL_TEXTURE1);
/*
** setup the base lightstyles so the lightmaps won't have to be regenerated
** the first time they're seen
@ -1530,6 +1273,5 @@ GL_EndBuildingLightmaps
void GL_EndBuildingLightmaps (void)
{
LM_UploadBlock( false );
GL_EnableMultitexture( false );
}

View file

@ -248,8 +248,6 @@ void R_TranslatePlayerSkin (int playernum);
void GL_Bind (int texnum);
void GL_MBind( GLenum target, int texnum );
void GL_TexEnv( GLenum value );
void GL_EnableMultitexture( qboolean enable );
void GL_SelectTexture( GLenum );
void R_LightPoint (vec3_t p, vec3_t color);
void R_PushDlights (void);

View file

@ -378,12 +378,6 @@ extern void ( APIENTRY * qglColorTableEXT)( GLenum, GLenum, GLsizei, GLenum, GLe
extern void ( APIENTRY * qglLockArraysEXT) (int , int);
extern void ( APIENTRY * qglUnlockArraysEXT) (void);
extern void ( APIENTRY * qglMTexCoord2fSGIS)( GLenum, GLfloat, GLfloat );
extern void ( APIENTRY * qglSelectTextureSGIS)( GLenum );
extern void ( APIENTRY * qglActiveTextureARB)( GLenum );
extern void ( APIENTRY * qglClientActiveTextureARB)( GLenum );
#if defined __linux__ || defined __FreeBSD__
// local function in dll
extern void *qwglGetProcAddress(char *symbol);