diff options
author | SmileTheory <SmileTheory@gmail.com> | 2015-03-12 21:44:06 -0700 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:47:04 +0000 |
commit | 83e617c13b0d149482e8cc82295b25e9a64f2109 (patch) | |
tree | 6d3df6c4317804b615a2dd375ad7f1241a7d32c9 | |
parent | 4bb0b58386abc4edc2abd89e671c8fcf9e3d0007 (diff) |
OpenGL2: Fix culling again.
-rw-r--r-- | src/renderergl2/tr_backend.c | 17 | ||||
-rw-r--r-- | src/renderergl2/tr_shade.c | 30 |
2 files changed, 21 insertions, 26 deletions
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c index 28fb13c9..6c03db3c 100644 --- a/src/renderergl2/tr_backend.c +++ b/src/renderergl2/tr_backend.c @@ -128,25 +128,12 @@ void GL_Cull( int cullType ) { } else { - qboolean cullFront; + qboolean cullFront = (cullType == CT_FRONT_SIDED); if ( glState.faceCulling == CT_TWO_SIDED ) - { qglEnable( GL_CULL_FACE ); - } - - cullFront = (cullType == CT_FRONT_SIDED); - if ( backEnd.viewParms.isMirror ) - { - cullFront = !cullFront; - } - - if ( backEnd.currentEntity && backEnd.currentEntity->mirrored ) - { - cullFront = !cullFront; - } - if (glState.faceCullFront != cullFront) + if ( glState.faceCullFront != cullFront ) qglCullFace( cullFront ? GL_FRONT : GL_BACK ); glState.faceCullFront = cullFront; diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c index da293cb8..9853313c 100644 --- a/src/renderergl2/tr_shade.c +++ b/src/renderergl2/tr_shade.c @@ -1506,20 +1506,28 @@ void RB_StageIteratorGeneric( void ) // // set face culling appropriately // - if ((backEnd.viewParms.flags & VPF_DEPTHSHADOW)) + if (input->shader->cullType == CT_TWO_SIDED) { - //GL_Cull( CT_TWO_SIDED ); - - if (input->shader->cullType == CT_TWO_SIDED) - GL_Cull( CT_TWO_SIDED ); - else if (input->shader->cullType == CT_FRONT_SIDED) - GL_Cull( CT_BACK_SIDED ); - else - GL_Cull( CT_FRONT_SIDED ); - + GL_Cull( CT_TWO_SIDED ); } else - GL_Cull( input->shader->cullType ); + { + qboolean cullFront = (input->shader->cullType == CT_FRONT_SIDED); + + if ( backEnd.viewParms.flags & VPF_DEPTHSHADOW ) + cullFront = !cullFront; + + if ( backEnd.viewParms.isMirror ) + cullFront = !cullFront; + + if ( backEnd.currentEntity && backEnd.currentEntity->mirrored ) + cullFront = !cullFront; + + if (cullFront) + GL_Cull( CT_FRONT_SIDED ); + else + GL_Cull( CT_BACK_SIDED ); + } // set polygon offset if necessary if ( input->shader->polygonOffset ) |