View Full Version : dynamicly changing the clipping planes
Hi, I'm trying to display a scene that consists of several random simple objects. This scene has dynamically changing front and back clipping planes. The objects in the scene should not move, but some may become partially or fully clipped as the clipping planes move back and forth. If you were watching it and the front clipping plane were moving away from you, you should see the faces of the objects start to disappear. If the back clipping plane were moving forward, the backs of the objects would disappear. I hope this makes sense.
Anyway, I've tried using glOrtho() and glFrustum(), but whenever i set new values for near and far, the objects seem to get closer or farther away from the camera. How can I get them to stay still?
04-13-2003, 10:44 PM
The near clipping plane is also where the image is projected, so if you change the distance to the near clipping plane you also change the distance to the image plane and that's why it look's like they are moving, it's like zooming.
I guess it would be possible to compensate for this by changing the coordinates for the near clipping plane, but I am not sure how to calculate them though.
Hmm, that explains some of the behavior, but the specs (its a school project) make it seem like there should be 3 separate planes: the view plane (or projection plane), the front clipping plane, and the back clipping plane. Among other things, we need to have:
"Two buttons to change the distance from the camera to the viewplane (+d, -d)." AND
"Four buttons to change the distance to the front and back clipping planes (+f, -f, +b, -b)"
I have no idea how to implement a separate viewplane if the front clipping plane is the same thing in OpenGL.
04-14-2003, 12:45 AM
I don't think opengl really uses the concept of "view plane", so it's a bit hard to tell what you're supposed to do. Maybe you have to build your own projection matrix according to those values, I'm sure there are examples on this in your course book.
Other than that, gluPerspective lets you change the near and far planes without changing the actual projection, so it'll solve that problem at least.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.