View Full Version : Relationship between glOrtho() and gluLookAt()?

10-25-2003, 08:33 PM
I am in the process of porting a previous graphics lab to OpenGL (which happens to be our next lab!), but am hitting some snags.

While I was messing around with my projection dimensions, I noticed a pretty unusual relationship, and I don't really understand it.

In order for me to see my object, my camera has to be located within the viewing volume defined in glOrtho() for a parallel projection. Why is this the case? I thought the glOrtho() function was only designed to specify the clipping parameters of the view-plane and it's respective volume (with the Z parameters).

So now, when specifying my gluLookAt functions, my camera position (PRP) needs to be located somewhere inside the viewing volume that has been specified by glOrtho(). This really doesn't make sense to me, since we have been taught that our camera simply maps everything inside the viewing volume against the view-plane, and the camera placement just specifies the direction of projection (DOP) to the view-plane from our fixed point in space.

Sorry if I am rambling, I've been staring at this problem for a good while now, and can't really make any sense out of it. Thanks for any input!! http://www.opengl.org/discussion_boards/ubb/smile.gif

10-26-2003, 02:58 PM
Any ideas?

I can easily run a clipping-type algorithm to move the camera at the edge of the viewing volume, but this still does not make sense to me. Thanks! http://www.opengl.org/discussion_boards/ubb/smile.gif

10-27-2003, 12:31 AM
I think you have the idea slightly backwards. It's not that you have to palce the viewpoint inside the view volume. When you move the viewpoint, you move the view volume with it, so the view volume is always at the exact same place relative the view point. It's the objects that has to be placed inside the view volume as you move the viewpoint around.

Or if you want a second way to look at it, which is, to OpenGL, the more correct one, because of the way it works, but you are free to interpret it the way you like. The view point is fixed at the world origin, and the view volume is fixed around this viewpoint. When you move the viepwoint, you actually move your objects around in the opposite direction. As you move them further away, they will at some point end up outside the view volume, which is at a fixed position.