Hi Grigoriev,
With osgViewer there is several ways to move the camera, which basically
means setting its view matrix, if you want your can simply do:
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("myfile.osg"));
viewer.realize();
while (!viewer.done())
{
viewer.getCamera()->setViewMatrix(myViewMatrix);
viewer.frame(); // note, frame() now calls viewer.advance(),
eventTraversal(), updateTraversal() and renderingTraversal();
}
Or
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("myfile.osg"));
viewer.addCameraManipulator(new MyCameraManipulator());
viewer.realize();
while (!viewer.done())
{
// eventTraversal will now use the attached camera manipulator to
update the Camera's view matrix.
viewer.frame(); // note, frame() now calls viewer.advance(),
eventTraversal(), updateTraversal() and renderingTraversal();
}
The last little section, after the viewer.addCameraManipulator(..) can be
replaced by run() as it'll basically do the same as the
manual frame loop (have a look at the Viewer.cpp to see what it does)
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("myfile.osg"));
viewer.addCameraManipulator(new MyCameraManipulator());
viewer.run();
Robert.
On 5/3/07, Роман Григорьев <[EMAIL PROTECTED]> wrote:
Hi guys!
I'm learning OSG and have a question how to move camera now because in
examples I see this
while( !viewer.done() )
{
viewer.getCamera()->setViewMatrix(seh->getCameraPosition());
// fire off the cull and draw traversals of the scene.
viewer.frame();
}
but now OSG use different approach
viewer.run();
so as I got I have to use callbacks - so my question how to use
updatecallbacks to move camera?
Thanx in advance
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/