I assume there is no issue with the method virtual bool replaceChild
<http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs
/classosg_1_1Group.html#a11> (Node
<http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs
/classosg_1_1Node.html> *origChild, Node
<http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs
/classosg_1_1Node.html> *newChild). For some reason, this code core
dumps somewhere in the depths of replaceChild, or I think it does. The
code adds and deletes, but crashes when I try to update something
already in the group. Any ideas what I am doing wrong?
osg::ref_ptr<osg::Geode> g[10];
osg::ref_ptr<osg::Geode> tmp;
void drawTrack::deleteTrk(int trk_list[], int num_del)
{
int i = 0;
trck d;
osg::Group* group = PPIViewport::getGroup();
osgProducer::Viewer* viewer = PPIViewport::getViewer();
while(i < num_del)
{
group->removeChild(g[trk_list[i]].get());
viewer->requestRedraw();
i++;
}
}
void drawTrack::drawTrk(TrkMdl** t)
{
int i = 0;
const float OFFSET = .005;
trck d;
osg::Group* group = PPIViewport::getGroup();
osgProducer::Viewer* viewer = PPIViewport::getViewer();
while(t[i] != NULL)
{
if(group->containsNode(g[i].get()))
{
tmp = d.draw((t[i]->latitude * OFFSET), (t[i]->longitude *
OFFSET), t[i]->track_id);
group->replaceChild(g[i].get(), tmp.get());
g[i] = tmp;
}
else
{
g[i] = d.draw((t[i]->latitude * OFFSET), (t[i]->longitude *
OFFSET), t[i]->track_id);
group->addChild(g[i].get());
}
i++;
}
}
Thanks,
Randy Neatrour
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/