]> git.tdb.fi Git - libs/gl.git/commitdiff
Fully unbind Clipping when legacy mode changes
authorMikko Rasa <tdb@tdb.fi>
Sun, 14 Aug 2016 08:45:56 +0000 (11:45 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 14 Aug 2016 08:45:56 +0000 (11:45 +0300)
Failing to do so may leave ClipPlanes bound to ClipUnits, leading to
undesirable behaviour later on.

source/clipping.cpp

index 487eeca638cbcfd7a33e1c04e086b124c47b7cbd..430a7b6fd05918b43c62204b18859bdd47a828f0 100644 (file)
@@ -57,9 +57,12 @@ void Clipping::bind(bool legacy) const
 {
        if(legacy)
                static Require _req(MSP_legacy_features);
+       
+       if(legacy!=bound_with_legacy)
+               unbind();
 
        const Clipping *old = current();
-       if(!set_current(this) && !(legacy && !bound_with_legacy))
+       if(!set_current(this))
                return;
 
        bound_with_legacy = legacy;