]> git.tdb.fi Git - libs/gl.git/blobdiff - source/clipping.cpp
Implement the previously forgotten Clipping::unbind
[libs/gl.git] / 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