Hi Ahmed,
The reason why you app is terminating is that your addDrawable on the
geode is most likely invalidating the iterator that is help in the
UpdateVisitor::apply()/traversed method as the callback is a nested
call.
If you want to add/remove drawables it's best not to do this via a
callback on the Geode, move this operation to after the update
traversals.
Robert.
On Wed, Jun 25, 2008 at 4:11 PM, Ahmed Nawar <[EMAIL PROTECTED]> wrote:
>
> Dear All,
>
> i attached a callback to a geode node.
>
> CallBack operator:
>
> void GeodeCallBack::operator()( osg::Node* node, osg::NodeVisitor* nv )
> {
>
> osg::Geode* geode =
> dynamic_cast<osg::Geode*>( node );
>
> geode->removeDrawables(0,geode->getNumDrawables ());
>
> // get different drawable.
> osg::Drawable *d = drawableBuilder->getDrawable(dataPoint->shape);
>
> geode->addDrawable( d );
>
> traverse( node, nv );
> }
>
>
> 1- is it Ok to change the geode's contains in the callback?
> 2- some times the " geode->addDrawable( d ); " terminate the program. any
> ideas?
>
> Thanks,
> Ahmed Nawar
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org