PDA

View Full Version : Q on glOrtho / zooming in orthographic projection



roelv
06-12-2009, 03:15 AM
Hi all,

Quick question to make sure that I understand properly. For context, I'm working on a toy CAD / 3-d building modeler application to learn about OpenGL; it has both 2d (from several angles) and 3d (perspective, with flee-floating camera) view modes.

- Am I correct in saying that when using an orthographic projection (for my 2d modes), the distance from the camera to the object being viewed doesn't matter? I.e., an object that is 10 away from the camera origin (as set with gluLookAt()) is drawn the same size as an object that is 100 away?

- Is it correct that zooming in on a scene (in 2D, top-down view) should be done by manipulating the scene bounding box as determined by the parameters passed to glOrtho()?

I started out with the assumption that I could zoom out, in a glOrtho() scene, by moving the camera away from the scene being viewed. That turned out not to work. Upon reading my books understand that only in perspective mode the distance from the camera to my objects is taken into account when determining the size of the object to draw. A contrario I deduce from that that for orthographic modes it doesn't work. Just thought I'd check before I waste another night barking up the wrong tree :)

Thanks.

ZbuffeR
06-12-2009, 03:21 AM
yes.

and yes.

Orthographic has camera at infinite distance, so inf plus or minus any value is still infinity.

By the way, "pure" zooming on a 3D view is done by reducing the field of view, without moving camera (same as ortho view in fact).
Moving the camera forward/backward is something different, as it changes the perspective.

Of course, both have their uses.

roelv
06-12-2009, 04:03 AM
Thank you.

I see your point on zooming in 3d views. I will have to decide whether 'pure' zooming as you call it is needed in my application or whether what the user really wants is 'moving the camera'.

Anyway I'll get started on my 2d, ortho view first :)