i'm having a problem when I remove a node from the root node of a scene graph.
specifically, it appears that the update callback is getting messed up. the
reason this is important is that I want to hold the object out of sight for
a while, then add it back to the scene graph and keep going ...
my code looks something like this (based on Joseph Sullivan's excellent
tutorials)
osg::Node* tankNode = osgDB::readNodeFile("blah, blah, blah");
osg::MatrixTransform * tankTransform = new osg::MatrixTransform();
tankTransform->setUpdateCallback( new orbit() ); // drives in a circle
tankTransform->addChild( tankNode );
scene_root->addChild( tankTransform );
then later, i do something like this:
scene_root->removeChild( tankTransform );
and still later, i want to do this:
scene_root->addChild( tankTransform );
but it causes some kind of error (which are hard to debug on a windows system
since OSG and visual studio fight over the display). after tracking things
down,
i found that if i print the value of the callback (the pointer) before and after
the remove
cout << "hide_unit() callback = 0x" << tankTransform->getUpdateCallback()
<< endl;
root->removeChild( tankTransform );
cout << "hide_unit() callback = 0x" << tankTransform->getUpdateCallback()
<< endl;
i get the following ...
hide_unit() callback = 0x0919C510
hide_unit() callback = 0xDDDDDDDD
if i store the pointer and try to check inside the callback, it is also messed
up
internally. any ideas about what's causing this and what I can do to fix it?
thanks,
Jeff Hanes
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/