I have a problem with removing drawables from a geode. I created a class which inherits from osg::Geode. In my class I overwrite the accept method. The goal is to implement my own culling mechanism. So I check if the node visitor is a cullvisitor. Then I want to remove all drawables and add new ones, depending on the camera position.
The Code looks like this.

void WWOsgNode::accept(osg::NodeVisitor &nv)
{
if(nv.getVisitorType() == nv.CULL_VISITOR)
  {
  printf("I am a cull Vistor\n");

   try {
   this->removeDrawables(1,this->getNumDrawables());
  }
   catch(...)
  {
  printf("Something wrong while removing stuff\n");
  }

printf("Number of drawables in Displaylist: %d\n",this->getNumDrawables());
  ...
}

this crashes the program. The program runs when I remove the removeDrawables call. I already tried to iterate over all drawables removing everyone with removeDrawable. This causes the same problems. I can provide a backtrace if this helps. My OpenSceneGraph version is 1.2 on Ubuntu Feisty compiled from source. I tried other version of OpenSceneGraph so I guess I am doing something wrong.
What am I missing?
I hope somebody can help

Martin
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to