PDA

View Full Version : using viewport to generate clip planes

bumby
07-10-2003, 06:37 AM
Hi,

So I think there must be an easier way to do this.....

I am trying to make an effect where I can clip out a portion of the window. As I understand, the plane equation in glClipPlane has to be in object coordinates, and then the clipper takes care of putting it in eye coordinates. This is fine, but if I want to use say a plane that cuts the scene 1/4 the way from the top, how do I get this in object coordinates?

The way I thought would work, would be to find the values of the points in eye coordinates that make up the near plane. Then find some new points 1/4 the way down from the top. But then I would have to transform them to object coordinates (not sure how this is done) for the clipper to then transform them back to eye coordinates? Does this seem right? Isnt it a redundant transformation? (that is why I am wondering if there is a better way).

So..basically, I am looking for a way to get a clip plane in object coordinates from a plane in window coordinates...

Another kind of related question, is : how can you determine how far an object would have to move before it would move out of the view.

[This message has been edited by bumby (edited 07-10-2003).]

[This message has been edited by bumby (edited 07-10-2003).]

roffe
07-10-2003, 11:43 AM
Originally posted by bumby:
So..basically, I am looking for a way to get a clip plane in object coordinates from a plane in window coordinates...

For viewport clipping, lookup Scissoring=glScissor

Another kind of related question, is : how can you determine how far an object would have to move before it would move out of the view.

From the projection and modelview matrices you can extract the planes that define the viewing frustum. Great tutorial including code here: http://www.markmorley.com/opengl/frustumculling.html

bumby
07-11-2003, 05:50 AM
Thanks,

I think glScissor is what i was looking for...not glClipPlane...