Hi Martin,

When using viewer->run() my scene appears ok and the camera/view appear to
be outside of the cow, but when updating my scene manually using
viewer->frame()  I end up viewing inside the cow, how do I set my camera or
view position when updating the frame manually, does viewer->run() calculate
the view of the entire scene automatically?
I am slight lost at the moment!!! :)

I saw you got it working, but just so you know there's no magic going on, here's the explanation for the above.

viewer->run() automatically attaches an osgGA::TrackballManipulator to the viewer. This in turn automatically calculates the view matrix based on the scene bounds on the first frame. To get the same behavior when using viewer->frame() you would just have to call viewer->setCameraManipulator(new osgGA::TrackballManipulator); .

Or you can modify the main camera's view matrix each frame before calling viewer->frame(). You can use viewer->getCamera()->setViewMatrixAsLookAt(...); for example, or build your own view matrix and set it with viewer->getCamera()->setViewMatrix(matrix); .

Hope this helps explain it a bit.

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to