diff options
author | Zack Middleton <zturtleman@gmail.com> | 2014-10-29 01:32:50 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:38:54 +0000 |
commit | f3fe657d5e529f9f5235823d7b356d5a55aa04b3 (patch) | |
tree | 672a52a86cc6b4cd7e94463df8ff2a4fc3017e37 /src/renderergl1 | |
parent | 97056fbf4fead4f9b68a7ec6ad0ecaec8d5f5d07 (diff) |
Always use GL_Cull to change cull state
Manually changing cull state can cause later GL_Cull calls to not change
the cull state.
Diffstat (limited to 'src/renderergl1')
-rw-r--r-- | src/renderergl1/tr_backend.c | 2 | ||||
-rw-r--r-- | src/renderergl1/tr_shadows.c | 28 |
2 files changed, 8 insertions, 22 deletions
diff --git a/src/renderergl1/tr_backend.c b/src/renderergl1/tr_backend.c index 803bc4a2..46284bfa 100644 --- a/src/renderergl1/tr_backend.c +++ b/src/renderergl1/tr_backend.c @@ -711,7 +711,7 @@ void RB_SetGL2D (void) { GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA ); - qglDisable( GL_CULL_FACE ); + GL_Cull( CT_TWO_SIDED ); qglDisable( GL_CLIP_PLANE0 ); // set time for 2D shaders diff --git a/src/renderergl1/tr_shadows.c b/src/renderergl1/tr_shadows.c index 6f9ef5f4..670b41d8 100644 --- a/src/renderergl1/tr_shadows.c +++ b/src/renderergl1/tr_shadows.c @@ -212,7 +212,6 @@ void RB_ShadowTessEnd( void ) { // draw the silhouette edges GL_Bind( tr.whiteImage ); - qglEnable( GL_CULL_FACE ); GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); qglColor3f( 0.2f, 0.2f, 0.2f ); @@ -223,28 +222,15 @@ void RB_ShadowTessEnd( void ) { qglEnable( GL_STENCIL_TEST ); qglStencilFunc( GL_ALWAYS, 1, 255 ); - // mirrors have the culling order reversed - if ( backEnd.viewParms.isMirror ) { - qglCullFace( GL_FRONT ); - qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); + GL_Cull( CT_BACK_SIDED ); + qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); - R_RenderShadowEdges(); + R_RenderShadowEdges(); - qglCullFace( GL_BACK ); - qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR ); + GL_Cull( CT_FRONT_SIDED ); + qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR ); - R_RenderShadowEdges(); - } else { - qglCullFace( GL_BACK ); - qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); - - R_RenderShadowEdges(); - - qglCullFace( GL_FRONT ); - qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR ); - - R_RenderShadowEdges(); - } + R_RenderShadowEdges(); // reenable writing to the color buffer @@ -273,7 +259,7 @@ void RB_ShadowFinish( void ) { qglStencilFunc( GL_NOTEQUAL, 0, 255 ); qglDisable (GL_CLIP_PLANE0); - qglDisable (GL_CULL_FACE); + GL_Cull( CT_TWO_SIDED ); GL_Bind( tr.whiteImage ); |