PDA

View Full Version : Clipping planes



Coert
09-27-2005, 02:36 AM
I was using 6 clipping planes (glClipPlane) on NVidia to clip the volume and it was working fine. Now I am using them on ATI and it looks like it isn't the volume that gets clipped but only the framebuffer. When rotating the volume, clipping planes stay fixed at the same position. Is this a know problem, or am I maybe doing something wrong?

dorbie
09-27-2005, 12:23 PM
It may be a driver bug.

A key part of specifying clipping planes is the transformation of the plane equationas through the inverse modelview matrix.

If the driver fails to do this then the clip planes will look like they're stationary in eye space.

However in order for the clip planes to be correctly transformed they need to be specified each frame after you're placed the appropriate transformations (including viewing and any model xforms they move with) on the modelview matrix stack.

You may not be doing this because of code paths you have exclusive to the ATI card.

There may be some buggy optimization code that you can workaround by disabling and enabling clipping planes when you specify the plane equation.

An alternative workaround that will certainly work on all platforms is to specify the clip planes in eye space (identity on the modelview matrix) but perform the plane equation transformation to the eyespace object position yourself. Basically transforming the plane equations through inverse modelview in your software before calling glClipPlane.

My bet is you've got some bug in your code w.r.t. specifying the glClipPlanes each frame, this should help you figure out what that bug is.