Hi,
I am studying how to delete node from root recentlly.
I am so puzzled.
I create a skybox node, then add to root.
then i create a button, click it to create skybox. click again to delete
ckybox. click again and again, create, delete.
//not show skybox
if(!pDoc->m_cSky.m_bShow)
{
//remove node, clear the memory.
mRoot->removeChild(m_SkyNode);
// if(m_SkyNode != NULL)
// m_SkyNode.release();
}
else
{
//create skybox
if(!m_SkyNode)
m_SkyNode = pDoc->m_cSky.createSkyBox(m_SkyNode);
mRoot->addChild(m_SkyNode);
}
I found if I don't use m_SkyNode.release(), the memory the program using is
never changed.
If I use m_SkyNode.release(), the memory increases again and again.
Then I use osg::ref_ptr<osg::Image> in the osg::TextureCubeMap*
CCSky::readCubeMap(), no any use for decrease memory.
then I want to free(imagePosX) or delete(imagePosX), which is created by
osgDB::readImageFile(CUBEMAP_FILENAME(posx)), error come out, the destructor
function is protected.
Can anyone help me? don't ask me why I want to delete it from memory, I just
want to know how.
Thank you!
Cheers,
LUO
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64469#64469
Attachments:
http://forum.openscenegraph.org//files/skybox_184.h
http://forum.openscenegraph.org//files/skybox_198.cpp
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org