ref: gl: only enable/disable texture units in fixed-function pipeline rendering, in our case, low TMUs
This commit is contained in:
parent
4ed562697b
commit
22f60d50ac
3 changed files with 26 additions and 6 deletions
|
@ -259,6 +259,27 @@ void GL_MultiTexCoord2f( GLenum texture, GLfloat s, GLfloat t )
|
||||||
pglMultiTexCoord2f( texture + GL_TEXTURE0_ARB, s, t );
|
pglMultiTexCoord2f( texture + GL_TEXTURE0_ARB, s, t );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
GL_EnableTextureUnit
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void GL_EnableTextureUnit( int tmu, qboolean enable )
|
||||||
|
{
|
||||||
|
// only enable fixed-function pipeline units
|
||||||
|
if( tmu < glConfig.max_texture_units )
|
||||||
|
{
|
||||||
|
if( enable )
|
||||||
|
{
|
||||||
|
pglEnable( glState.currentTextureTargets[tmu] );
|
||||||
|
}
|
||||||
|
else if( glState.currentTextureTargets[tmu] != GL_NONE )
|
||||||
|
{
|
||||||
|
pglDisable( glState.currentTextureTargets[tmu] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
GL_TextureTarget
|
GL_TextureTarget
|
||||||
|
@ -274,11 +295,10 @@ void GL_TextureTarget( uint target )
|
||||||
|
|
||||||
if( glState.currentTextureTargets[glState.activeTMU] != target )
|
if( glState.currentTextureTargets[glState.activeTMU] != target )
|
||||||
{
|
{
|
||||||
if( glState.currentTextureTargets[glState.activeTMU] != GL_NONE )
|
GL_EnableTextureUnit( glState.activeTMU, false );
|
||||||
pglDisable( glState.currentTextureTargets[glState.activeTMU] );
|
|
||||||
glState.currentTextureTargets[glState.activeTMU] = target;
|
glState.currentTextureTargets[glState.activeTMU] = target;
|
||||||
if( target != GL_NONE )
|
if( target != GL_NONE )
|
||||||
pglEnable( glState.currentTextureTargets[glState.activeTMU] );
|
GL_EnableTextureUnit( glState.activeTMU, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,9 @@ void GL_Bind( GLint tmu, GLenum texnum )
|
||||||
|
|
||||||
if( glState.currentTextureTargets[tmu] != glTarget )
|
if( glState.currentTextureTargets[tmu] != glTarget )
|
||||||
{
|
{
|
||||||
if( glState.currentTextureTargets[tmu] != GL_NONE )
|
GL_EnableTextureUnit( tmu, false );
|
||||||
pglDisable( glState.currentTextureTargets[tmu] );
|
|
||||||
glState.currentTextureTargets[tmu] = glTarget;
|
glState.currentTextureTargets[tmu] = glTarget;
|
||||||
pglEnable( glState.currentTextureTargets[tmu] );
|
GL_EnableTextureUnit( tmu, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glState.currentTextures[tmu] == texture->texnum )
|
if( glState.currentTextures[tmu] == texture->texnum )
|
||||||
|
|
|
@ -301,6 +301,7 @@ void GL_CleanupAllTextureUnits( void );
|
||||||
void GL_LoadIdentityTexMatrix( void );
|
void GL_LoadIdentityTexMatrix( void );
|
||||||
void GL_DisableAllTexGens( void );
|
void GL_DisableAllTexGens( void );
|
||||||
void GL_SetRenderMode( int mode );
|
void GL_SetRenderMode( int mode );
|
||||||
|
void GL_EnableTextureUnit( int tmu, qboolean enable );
|
||||||
void GL_TextureTarget( uint target );
|
void GL_TextureTarget( uint target );
|
||||||
void GL_Cull( GLenum cull );
|
void GL_Cull( GLenum cull );
|
||||||
void R_ShowTextures( void );
|
void R_ShowTextures( void );
|
||||||
|
|
Loading…
Add table
Reference in a new issue