PDA

View Full Version : Clipping plane

yossi
05-20-2001, 11:00 PM
How can I see the clipped portion of an object and not the part that is toward the view point? How can I control what side of a clipping plane is seen and what part is not.
Thanks

RandyU
05-22-2001, 07:27 PM
Maybe you should disable culling.
You can control part (half-space) by multiplying equation on -1.

john
05-22-2001, 10:11 PM
Hello,

what randy said is true, but it isn't quite as ad hoc as trying a plane, realising its wrong, and then multiplying it by -1.

a 3D plane is defined by the equation

Ax + By + Cz + D = 0

Any point in three space can be mapped to the LHS of the equation. If the answer is 0, then the point lies ON the plane; if the answer is >0, then the point lies on the positive semispace of the plane (and is retained by OpenGL); otherwise the point lies on the negative space of the plane (and is clipped).

The magic important point about the plane equation is that its normal is given by <A, B, C>. So, for example, the plane

0x + 0y -1z + 0
= -z

is the plane passing through the origin with normal pointing down the negative z axis. Ergo, any point with a negative z value will be retained, whereas any positive z will be clipped. My point is that this can all be worked out mathematically without guessing and then multiplying by -1 when it doesn't work.

cheers,
John

kistompika
05-22-2001, 10:38 PM
You can control the face to cull with glCullFace(). Default is GL_BACK. If You change it to GL_FRONT the other side of the face will be culled.

Hope that's you wanted http://www.opengl.org/discussion_boards/ubb/smile.gif

kistompika
05-22-2001, 10:43 PM
Sorry... I didn't understand your question for first http://www.opengl.org/discussion_boards/ubb/frown.gif