Hi All,
I'm a beginner so my questions are really simple. I'm trying to use Osg in a Qt application. I started looking at the osgviewerQT example and modifying it I found something I don't understand. I would like to add a level in my Osg node object hierarchy.

#if 0 // original code
      ViewerQT* viewer = new ViewerQT;
      viewer->setCameraManipulator(new osgGA::TrackballManipulator);
      viewer->setSceneData(loadedModel.get());
#else
      ViewerQT* viewer = new ViewerQT;
      viewer->setCameraManipulator(new osgGA::TrackballManipulator);
      osg::ref_ptr<osg::Group> root = new osg::Group;
      viewer->setSceneData(root);
      root->addChild(loadedModel.get());
#endif

In the second version of the code the manipulator does not seem to work properly: I can rotate the loaded object pushing the left mouse button but nothing happens pushing the left and middle button. Why?
On the contrary if I call
viewer->setSceneData(root);
after
root->addChild(loadedModel.get());
it works fine.

In my ideal scenario I would like to update my object hierarchy in a piece of code that does not know the existence of a viewer or other viewers that are showing a scene of that hierarcgy. Is there a way to implement it? Why the viewer is able to show automatically the new object, just setting it as child of the root node, but the manipulator is not able to handle that correctly?

Regards
Gianni


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to