[osg-users] zoom and orthographic projections

2009-03-26 Thread Cory Riddell
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] zoom and orthographic projections

2009-03-26 Thread Paul MARTZ
TrackballManipulator doesn't support zoom, it only supports moving the  
viewpoint forwards  backwards, which has no visible effect in ortho.  
You'll need to create an event handler and have it modify the camera  
projection matrix.


Paul Martz
Skew Matrix Software


On Mar 26, 2009, at 8:35 AM, Cory Riddell c...@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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] zoom and orthographic projections

2009-03-26 Thread Paul MARTZ
Zoom in ortho is done by shrinking or expanding the view volume  
defined by the left right top bottom planes.


Paul Martz
Skew Matrix Software


On Mar 26, 2009, at 8:35 AM, Cory Riddell c...@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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] zoom and orthographic projections

2009-03-26 Thread Robert Osfield
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 c...@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@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] zoom and orthographic projections

2009-03-26 Thread Cory Riddell




Hi Robert,

Our app is a CAD app and all the views are external views of the model.
I don't have any near/far plane issues. At first I thought I could
simulate an orthographic view by moving the camera very far away then
zooming in, but no.

Anyway, I won't post to the list about this anymore. But your
explanation (and Paul's explanation) of how orthographic views work was
helpful. Thanks.

Cory

Robert Osfield wrote:
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 c...@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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
  
  
  

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] zoom and orthographic projections

2009-03-26 Thread Paul Martz
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-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@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 c...@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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org