Clipping contour?

Hello,

Is there any way to get the clipping contour of the object being clipped when using glClipPlane?

Billy.

What do you want, exactly? Do you want the gometry of the intersection in some form, or do you just want a graphical projection of it? Correct me if I’m wrong, but I don’t think the first can be done automatically. There are hackish ways you could get an image of that projection, though.

Why do you want to do this? There may be a better way to solve the problem.

What I was thinking was getting the intersection between the clipping plane and the object being clipped. The intersection between the plane and the object (a set of polygons) would be a contour of lines. This way I would have a clear visualisation of the section. Although, I think there is no opengl function for that. I probably need to calculate this intersection and then render these contours.

There is a textbook technique, capping found in the red book. Will it serve your need?

Create a 3D texture with one black layer and the remaining white. Set TexGen to Object Linear and use the texture matrix to transform the plane (== the black layer in the 3D texture) up and down.

Otherwise you can do the coloring using vertex / fragment program and change the fragment color depending on the object positions z coordinate

You don’t need a 3D texture. A 1D texture with a single black pixel and the rest white will suffice; just map it along the plane of clipping using linear texgen.