summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_shade.c
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2016-01-18 04:46:01 -0800
committerTim Angus <tim@ngus.net>2016-04-07 11:53:16 +0100
commit970b21fbcd3d42e641807ac0c5e9a29dc21095e9 (patch)
treef4d14a3d23053e64563a35799885ec44cc52b4b0 /src/renderergl2/tr_shade.c
parent14aa11b0de9c1a93b06cc5a8c6819b52268f4a54 (diff)
OpenGL2: Direct state access, part 1: Texture binds
Diffstat (limited to 'src/renderergl2/tr_shade.c')
-rw-r--r--src/renderergl2/tr_shade.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c
index 04b62517..f4d32a5e 100644
--- a/src/renderergl2/tr_shade.c
+++ b/src/renderergl2/tr_shade.c
@@ -102,11 +102,9 @@ static void R_BindAnimatedImageToTMU( textureBundle_t *bundle, int tmu ) {
int index;
if ( bundle->isVideoMap ) {
- int oldtmu = glState.currenttmu;
- GL_SelectTexture(tmu);
ri.CIN_RunCinematic(bundle->videoMapHandle);
ri.CIN_UploadCinematic(bundle->videoMapHandle);
- GL_SelectTexture(oldtmu);
+ GL_BindToTMU(tr.scratchImage[bundle->videoMapHandle], tmu);
return;
}
@@ -137,7 +135,7 @@ Draws triangle outlines for debugging
================
*/
static void DrawTris (shaderCommands_t *input) {
- GL_Bind( tr.whiteImage );
+ GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
qglDepthRange( 0, 0 );
@@ -415,7 +413,7 @@ static void ProjectDlightTexture( void ) {
vector[3] = scale;
GLSL_SetUniformVec4(sp, UNIFORM_DLIGHTINFO, vector);
- GL_Bind( tr.dlightImage );
+ GL_BindToTMU( tr.dlightImage, TB_COLORMAP );
// include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
// where they aren't rendered
@@ -863,11 +861,7 @@ static void ForwardDlight( void ) {
}
if (r_dlightMode->integer >= 2)
- {
- GL_SelectTexture(TB_SHADOWMAP);
- GL_Bind(tr.shadowCubemaps[l]);
- GL_SelectTexture(0);
- }
+ GL_BindToTMU(tr.shadowCubemaps[l], TB_SHADOWMAP);
ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb );
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
@@ -1267,7 +1261,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
if ( backEnd.depthFill )
{
if (!(pStage->stateBits & GLS_ATEST_BITS))
- GL_BindToTMU( tr.whiteImage, 0 );
+ GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
else if ( pStage->bundle[TB_COLORMAP].image[0] != 0 )
R_BindAnimatedImageToTMU( &pStage->bundle[TB_COLORMAP], TB_COLORMAP );
}