mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 08:08:02 +00:00
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
@ -259,6 +259,27 @@ void GL_MultiTexCoord2f( GLenum texture, GLfloat s, GLfloat 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
|
||||
@ -274,11 +295,10 @@ void GL_TextureTarget( uint target )
|
||||
|
||||
if( glState.currentTextureTargets[glState.activeTMU] != target )
|
||||
{
|
||||
if( glState.currentTextureTargets[glState.activeTMU] != GL_NONE )
|
||||
pglDisable( glState.currentTextureTargets[glState.activeTMU] );
|
||||
GL_EnableTextureUnit( glState.activeTMU, false );
|
||||
glState.currentTextureTargets[glState.activeTMU] = target;
|
||||
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] != GL_NONE )
|
||||
pglDisable( glState.currentTextureTargets[tmu] );
|
||||
GL_EnableTextureUnit( tmu, false );
|
||||
glState.currentTextureTargets[tmu] = glTarget;
|
||||
pglEnable( glState.currentTextureTargets[tmu] );
|
||||
GL_EnableTextureUnit( tmu, true );
|
||||
}
|
||||
|
||||
if( glState.currentTextures[tmu] == texture->texnum )
|
||||
|
@ -301,6 +301,7 @@ void GL_CleanupAllTextureUnits( void );
|
||||
void GL_LoadIdentityTexMatrix( void );
|
||||
void GL_DisableAllTexGens( void );
|
||||
void GL_SetRenderMode( int mode );
|
||||
void GL_EnableTextureUnit( int tmu, qboolean enable );
|
||||
void GL_TextureTarget( uint target );
|
||||
void GL_Cull( GLenum cull );
|
||||
void R_ShowTextures( void );
|
||||
|
Loading…
Reference in New Issue
Block a user