[osg-users] zoom and orthographic projections

Paul Martz pmartz at skew-matrix.com
Thu Mar 26 10:15:39 PDT 2009


Sorry for my curt response before -- it was from my cell.
 
Zooming in orthographic projection is not only possible, it's easy, and for
an OpenGL implementation example, I'll direct you to the OpenGL Distilled
example code: http://code.google.com/p/ogld/. See the Viewing example,
setProjection() method.
 
The Viewing example allows you to switch between perspective and
orthographic. You can change the alt/az of the eye and "zoom"(*) in either
projection mode. There are good code comments there describing how the code
mimics a change in eye distance while in orthographic projection.
 
(*) In perspective, the code allows you to move the eye forwards or
backwards without changing the FOV, so this is not a "zoom" in the strict
definition of the word, it is just a camera pan along the view vector. In
ortho, on the other hand, it is a true zoom (the FOV is shrunk or expanded),
as panning the eye along the view vector obviously has no effect in ortho.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
+1 303 859 9466
 

  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Thursday, March 26, 2009 8:48 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] zoom and orthographic projections


Hi Cory,

Orthographics views don't function like perspective ones, when you move near
to the center, nothing actually changes w.r.t your view.  This is normal and
what you shoudl expect.

If you want to "simulate" a perspective view by moving the left, right, top
and bottom values of the projection matrix in then it "kinda" works, but and
this is a HUGE BUT, you then hit issues what to do about the near and far
plane.  Soon you'll be trying your really hard to just and get get a
orthographic view and perspective to kinda work the same but you'll never
get to where you want to get to, perhaps some day after a few weeks of
trying you might just come to realization that it can't be done,
orthographic views just should never be used like perspetive one.

So... rather than waste much of your life, and much of our time trying to
support you give up now.  Learn that orthographic views are best kept for
external views of models where the whole model can be seen, or map views
where no issues with the near/far planes exist.  Once you get to this point
life will be good once more.

Robert.



On Thu, Mar 26, 2009 at 2:35 PM, Cory Riddell <cory at codeware.com> wrote:


I'm calling osg::Camera::setProjectionMatrixAsOrtho() and I'm getting an
orthographic projection (this is, if I look directly at the face of a
cube in wireframe, all I see is a square). I can rotate and pan, but
zoom isn't working (I'm dragging the right mouse button).

I want to allow the user to toggle between perspective and orthographic
projections. Obviously I need to do more than just set the projection
matrix, but I'm not sure where to start looking for clues. I've been
searching on setProjectionMatrixAsOrtho. What should I be looking for?

Thanks,
Cory Riddell


_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090326/13754ffc/attachment-0003.htm>


More information about the osg-users mailing list