<div dir="ltr"><div><div><div>Hello,<br><br></div>Sorry to bother again. I think this is somwhat a different topic from my previous post.<br>I am using a LOD based node, with several gourps/LODs.<br></div>At some point I want to completely wipe out my scene. How can I delete all nodes?<br><br><br></div>This is my code. I think it still leaves some nodes floating.<br><br>void rRemoveChildren(osg::Node* currNode) {<br><br>    osg::Group* currGroup;<br>    osg::Node*  foundNode;<br><br>    // check to see if we have a valid (non-NULL) node.<br>    // if we do have a null node, return NULL.<br>    if (!currNode) {<br>        return;<br>    }<br><br>    currGroup = currNode->asGroup(); // returns NULL if not a group.<br>    if (currGroup) {<br>        auto nChildren = currGroup->getNumChildren();<br>        for (int i = nChildren-1; i >=0; i--) {<br>            osg::Group* asGroup = currGroup->getChild(i)->asGroup();<br>            if (!asGroup || asGroup->getNumChildren() < 1) {<br>                osg::Node* shild = currGroup->getChild(i);<br>                shild->releaseGLObjects();<br>                currGroup->removeChild(shild);<br><br><br>            }<br>            else rRemoveChildren(asGroup);<br>        }<br>    } else {<br>        auto parents = currNode->getParents();<br>        for (auto p : parents)<br>            p->removeChild(currNode);<br>    }<br>}<br></div>