OpenGL2: Fix culling again.

This commit is contained in:
SmileTheory 2015-03-12 21:44:06 -07:00
parent 148603c951
commit 40cfbc9a82
2 changed files with 21 additions and 26 deletions

View file

@ -127,25 +127,12 @@ void GL_Cull( int cullType ) {
} }
else else
{ {
qboolean cullFront; qboolean cullFront = (cullType == CT_FRONT_SIDED);
if ( glState.faceCulling == CT_TWO_SIDED ) if ( glState.faceCulling == CT_TWO_SIDED )
{
qglEnable( GL_CULL_FACE ); qglEnable( GL_CULL_FACE );
}
cullFront = (cullType == CT_FRONT_SIDED); if ( glState.faceCullFront != cullFront )
if ( backEnd.viewParms.isMirror )
{
cullFront = !cullFront;
}
if ( backEnd.currentEntity && backEnd.currentEntity->mirrored )
{
cullFront = !cullFront;
}
if (glState.faceCullFront != cullFront)
qglCullFace( cullFront ? GL_FRONT : GL_BACK ); qglCullFace( cullFront ? GL_FRONT : GL_BACK );
glState.faceCullFront = cullFront; glState.faceCullFront = cullFront;

View file

@ -1505,20 +1505,28 @@ void RB_StageIteratorGeneric( void )
// //
// set face culling appropriately // set face culling appropriately
// //
if ((backEnd.viewParms.flags & VPF_DEPTHSHADOW)) if (input->shader->cullType == CT_TWO_SIDED)
{ {
//GL_Cull( 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 );
} }
else 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 // set polygon offset if necessary
if ( input->shader->polygonOffset ) if ( input->shader->polygonOffset )