From fdcf990dba1f09244d0f35b410caafe7d451432c Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 23 Jan 2007 16:51:26 +0000 Subject: [PATCH] fix bug in GL_CullFace which was causing it to often malfunction git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6741 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index b77e5fb9..7a15dc6c 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -591,29 +591,26 @@ void GL_DepthTest(int state) void GL_CullFace(int state) { - if (gl_state.cullface != state) + CHECKGLERROR + if (state != GL_NONE) { - CHECKGLERROR - if (state != GL_NONE) + if (!gl_state.cullfaceenable) { - if (!gl_state.cullfaceenable) - { - gl_state.cullfaceenable = true; - qglEnable(GL_CULL_FACE);CHECKGLERROR - } - if (gl_state.cullface != state) - { - gl_state.cullface = state; - qglCullFace(state);CHECKGLERROR - } + gl_state.cullfaceenable = true; + qglEnable(GL_CULL_FACE);CHECKGLERROR } - else + if (gl_state.cullface != state) { - if (gl_state.cullfaceenable) - { - gl_state.cullfaceenable = false; - qglDisable(GL_CULL_FACE);CHECKGLERROR - } + gl_state.cullface = state; + qglCullFace(gl_state.cullface);CHECKGLERROR + } + } + else + { + if (gl_state.cullfaceenable) + { + gl_state.cullfaceenable = false; + qglDisable(GL_CULL_FACE);CHECKGLERROR } } } -- 2.39.2