medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 83d315236aaff2175a307f4eee1d1e54f80bff10
parent ce10bf1cec94252dd274fa27e22d72fcaf64d22d
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Dec 29 22:00:11 +0200

Don't call glEnable( GL_CULL_FACE/GL_DEPTH_TEST ) unless it was disabled before

Diffstat:
renderer.cc | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -495,7 +495,9 @@ void renderer_draw_mesh( const Mesh & mesh, RenderState state ) { glDisable( GL_CULL_FACE ); } else { - glEnable( GL_CULL_FACE ); + if( previous_render_state.cull_face == CULLFACE_DISABLED ) { + glEnable( GL_CULL_FACE ); + } // TODO: current renderer is fucked and this should be the other way around glCullFace( state.cull_face == CULLFACE_FRONT ? GL_BACK : GL_FRONT ); } @@ -507,7 +509,9 @@ void renderer_draw_mesh( const Mesh & mesh, RenderState state ) { glDisable( GL_DEPTH_TEST ); } else { - glEnable( GL_DEPTH_TEST ); + if( previous_render_state.depth_func == DEPTHFUNC_DISABLED ) { + glEnable( GL_DEPTH_TEST ); + } glDepthFunc( depthfunc_to_glenum( state.depth_func ) ); } }