]> git.tdb.fi Git - libs/gl.git/commitdiff
Binding fixes for Clipping when mixing legacy and modern mode
authorMikko Rasa <tdb@tdb.fi>
Sat, 13 Aug 2016 15:29:14 +0000 (18:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 13 Aug 2016 15:29:14 +0000 (18:29 +0300)
source/clipping.cpp
source/renderer.cpp

index e309df58a98167a2ff415cdbc3b8b1a2bdac4556..487eeca638cbcfd7a33e1c04e086b124c47b7cbd 100644 (file)
@@ -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;
index 6a4c488f0b0ed81dcf1a9e35ce6f407f2651cf4f..cbec16e92a1bcfb8e00ca8df55a698c007077370 100644 (file)
@@ -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)
        {