Skip to content

Commit

Permalink
OpenGL2: Fix culling again.
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileTheory committed Mar 13, 2015
1 parent 148603c commit 40cfbc9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
17 changes: 2 additions & 15 deletions code/renderergl2/tr_backend.c
Expand Up @@ -127,25 +127,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;
Expand Down
30 changes: 19 additions & 11 deletions code/renderergl2/tr_shade.c
Expand Up @@ -1505,20 +1505,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 )
Expand Down

0 comments on commit 40cfbc9

Please sign in to comment.