[osg-users] [forum] How to make isometric view
Robert Osfield
robert.osfield at gmail.com
Fri Mar 16 04:59:50 PDT 2018
Hi Jean-Yves,
On 8 March 2018 at 16:33, Jean-Yves Garneau
<jean-yves.garneau at criq.qc.ca> wrote:
> I'm trying to figure out how to render my scene as an isometric view.
> I have not found a complete example.
> I have some boxes in my scene, so I compute the bounding box of the root node an using "getCamera()->setViewMatrixAsLookAt(eye, center, up) but it is not really orthogonal.
> Can someone have example to compute the eye position for isometric view?
For a isometric view you'll need to set the view and projection
matrices. I don't have an OSG example of doing an isometric view but
it shouldn't be hard. The Camera set up for a map view will be
something like:
osg::BoundingSphere bs = scenegraph->getBound();
double r = bs.radius();
view->getCamera()->setProjectionMatrixAsOrtho(-r, r, -r, r, -r, r);
view->getCamera()->setViewMatrixAsLookAt(bs.center()+osg::Vec3d(0.0,
0.0, r), bs.center(), osg::Vec3d(0.0, 1.0, 1.0));
Cheers,
Robert.
More information about the osg-users
mailing list