]> git.tdb.fi Git - libs/gl.git/commitdiff
Implement the previously forgotten Clipping::unbind
authorMikko Rasa <tdb@tdb.fi>
Sat, 13 Aug 2016 15:28:47 +0000 (18:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 13 Aug 2016 15:28:47 +0000 (18:28 +0300)
source/clipping.cpp

index add7bba68f698cd798511966226200361ee83240..e309df58a98167a2ff415cdbc3b8b1a2bdac4556 100644 (file)
@@ -99,6 +99,22 @@ void Clipping::bind(bool legacy) const
 
 void Clipping::unbind()
 {
+       const Clipping *old = current();
+       if(!set_current(0))
+               return;
+
+       if(bound_with_legacy)
+       {
+               for(unsigned i=0; i<old->planes.size(); ++i)
+                       if(old->planes[i])
+                               ClipPlane::unbind_from(i);
+       }
+       else
+       {
+               for(unsigned i=0; i<old->planes.size(); ++i)
+                       if(old->planes[i])
+                               disable(GL_CLIP_PLANE0+i);
+       }
 }
 
 } // namespace GL