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;
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