PDA

View Full Version : Clipping contour?



billy
01-29-2004, 08:20 AM
Hello,

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

Billy.

endash
01-29-2004, 12:16 PM
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.

billy
01-30-2004, 01:38 AM
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.

Coconut
01-30-2004, 05:18 AM
There is a textbook technique, capping found in the red book. Will it serve your need?

ScottManDeath
01-30-2004, 07:06 AM
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

jwatte
01-30-2004, 09:00 AM
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.