I believe your vector has to be storing pointers to the sphere objects, not
entire sphere objects themselves. And indeed the same pointer is passed to
addChild, as to removeChild afterwards, things *should* work as intended.
To make sure, print the pointer values you pass to addChild/removeChild to
verify.

some background:
Due to the private destructor of any child of osg::Referenced any such
object cannot be put into standard containers. OSG wants to stay in control
of object creation and destruction using its internal reference counting
system, and hence the destructor cannot be made public or the container
class would destroy the object whenever it wants (even when still
referenced by the OSG graph).

Christian


2015-10-22 13:52 GMT+02:00 Alvaro Ginestar <alvarogines...@hotmail.com>:

> hi everyone!!
> i try remove a sphere, with "removechild" it doesn't work.
> i use root->addChild(vector[x]); for to add the sphere in a node root and
> then i try to remove with root->removeChild(vector[x]);
> In the scene is draw a sphere, but it doesn't remove the sphere.
> someone know I'm doing wrong?
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to