From: Mikko Rasa Date: Sat, 13 Aug 2016 15:29:14 +0000 (+0300) Subject: Binding fixes for Clipping when mixing legacy and modern mode X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=2a27f2d40ef2359e347c838887101904789941d2 Binding fixes for Clipping when mixing legacy and modern mode --- diff --git a/source/clipping.cpp b/source/clipping.cpp index e309df58..487eeca6 100644 --- a/source/clipping.cpp +++ b/source/clipping.cpp @@ -59,7 +59,7 @@ void Clipping::bind(bool legacy) const static Require _req(MSP_legacy_features); const Clipping *old = current(); - if(!set_current(this)) + if(!set_current(this) && !(legacy && !bound_with_legacy)) return; bound_with_legacy = legacy; diff --git a/source/renderer.cpp b/source/renderer.cpp index 6a4c488f..cbec16e9 100644 --- a/source/renderer.cpp +++ b/source/renderer.cpp @@ -273,22 +273,22 @@ void Renderer::apply_state() } } - if(changed&CLIPPING) + if(state->clipping) { - if(state->clipping) + if(legacy_bindings) { - if(legacy_bindings) + if(changed&CLIPPING) { MatrixStack::modelview() = state->clipping_matrix; state->clipping->bind(true); changed = (changed&~CLIPPING)|LEGACY_MATRIX; } - else - state->clipping->bind(false); } else - Clipping::unbind(); + state->clipping->bind(false); } + else + Clipping::unbind(); if(state->shprog) {