[osg-users] [forum] How to make isometric view

Robert Osfield robert.osfield at gmail.com
Fri Mar 16 06:17:34 PDT 2018

HI Jean-Yves,

On 16 March 2018 at 13:11, Jean-Yves Garneau
<jean-yves.garneau at criq.qc.ca> wrote:
> Sometimes things seem to be very simple but when you are beginner, you miss details. It seem not to be enough to use the setViewMatrixAsLookAt() because I used setCameraManipulator(new osgGA::TrackballManipulator). I must used  this :
> Code:
> viewer->setCameraManipulator(new osgGA::TrackballManipulator);
> viewer->getCamera()->setProjectionMatrixAsOrtho(-1.0f, 1.0f, -1.0, 1.0f, -1.0f, 1.0f);
> osg::Vec3 eye(1.0, -1.0, 1.0);
> osg::Vec3 center(0.0, 0.0, 0.0);
> osg::Vec3 up(0.0, 0.0, 1.0);
> viewer->getCameraManipulator()->setHomePosition(eye, center, up);
> viewer->setSceneData(root);

This make sense for when you are using a Camera manipulator.  I would
advise caution with using standard osgGA camera manipulators with an
orthographic view as the zooming behaviour that works well for a
perspective view won't work with an orthographic view.  All of the
osgGA camera manipulators are written for perspective views.  If you
do do an interactive view then I would recommend implementing your own
camera manipulator, or just managing the view yourself by setting the
view and projection matrix in the main loop.


More information about the osg-users mailing list