User defined clip planes: Transform by modelview matrix...


What is the best method for forcing a UCP to be transformed by the modelview matrix? I’m not so much concerned about performance, more about doing it The Right Way.

At this point, I suppose for every frame I could:
glGet the modelview matrix
multiply by the UCP definition
redeclare the UCP with new definition
enable UCP
disable UCP

But, this seems very expensive for the end effect. Is there some magical shortcut I can enable which forces UCP’s to be transformed by the modelview matrix?



Depends on the effect you want to achieve.
Should the clip plane stay fixed in the view while the object is transformed or should it move with the object?

Here is the text from MS help on glClipPlane:
"When you call glClipPlane, equation is transformed by the inverse of the modelview matrix and stored in the resulting eye coordinates. Subsequent changes to the modelview matrix have no effect on the stored plane-equation components. "

I read this as: If you want to rotate the clip plane with the object you’ll have to call glClipPlane for each modelview change, otherwise only once at startup/definition of the plane.


That works. Calling glClipPlane() after doing whatever transforms causes those transforms to be applied. I had hoped that just enabling it would, but I suppose this method is the most flexible.

Thanks Relic.