PDA

View Full Version : Clipping Plane Issues



Rajveer
04-14-2002, 09:53 AM
This is part of the code I have in my drawing function:

glRotated(plane_x,1,0,0);
glRotated(plane_y,0,1,0);

double eqn[4] = {0.0, 1.0, tan(Plane_Angle*pi/180.0), 0.0};
glClipPlane(GL_CLIP_PLANE0, eqn);

if(makecut==1)
{
glEnable(GL_CLIP_PLANE0);
}
else if(makecut==0)
{
glDisable(GL_CLIP_PLANE0);
}

glRotated(X_Angle,1.0,0.0,0.0);
glRotated(Y_Angle,0.0,1.0,0.0);

//Draw the rest of the scene


plane_x and plane_y start out with a value of zero. X_Angle and Y_Angle are incremented and decremented by moving the mouse. I've coded in another function so that after the cut is made (makecut=1) plane_x and plane_y start to increase and decrease at the same rate as X_Angle and Y_Angle. This way when I rotate the cut scene, the clipping plane should rotate the same way and I should see the same objects clipped no matter how I rotate. But this doesn't happen, the clipping plane stays where it is and the result of rotating is that different parts of the scene appear and disappear.....why doesn't the clipping plane rotate also?? And I'm positive that the other functions are all fine.



[This message has been edited by Rajveer (edited 04-14-2002).]

Pat
04-15-2002, 10:09 AM
The clipping plane is defined by a vector, therefore there is no need to do a rotation before defining the clipping plane. The clipping plane equation will define the orientation relative to the current projection matrix.

Try

'rotate scene
'define clipping plane
'render scene

Hope that helps...