Thank you Robert, a little question. Will PagedLOD automaticaly unload children if I don't use DatabasePager?
Maxim. 2009/12/14 Robert Osfield <[email protected]> > Hi Maxim, > > I'm confused why you think that the memory isn't getting freed. The > OSG will be freeing the memory automatically when the viewer/database > goes out scope / and at by the DatabasePager at runtime when children > go out of range and get expired. Please note that expiry happens on > demand (default) or based on time depending on how the DatabasePager > is configure. In the default case the pager won't expire anything > till more than a specified target number PagedLOD is reached, beyond > this target it works to expire children to keep the total down to the > target. > > To cut a long store short, it'll almost certainly be doing exactly > what you need out of the box, and there is no need to worry about it. > > Robert. > > On Sat, Dec 12, 2009 at 5:26 PM, Maxim Gammer <[email protected]> wrote: > > Hi everybody. I need to figure out the PagedLOD technology... > > > > I've tried the following example, everything worked fine... > > > > osg::ref_ptr<osg::PagedLOD> plod = new osg::PagedLOD(); > > > > plod->setName("plod for "); > > > > plod->setRangeMode(osg::LOD::DISTANCE_FROM_EYE_POINT); > > > > std::string Filename1 = "/home/maximum2000/LABS/PLOD/osg/1.osg"; > > > > std::string Filename2 = "/home/maximum2000/LABS/PLOD/osg/2.osg"; > > > > std::string Filename3 = "/home/maximum2000/LABS/PLOD/osg/3.osg"; > > > > std::string Filename4 = "/home/maximum2000/LABS/PLOD/osg/4.osg"; > > > > plod->setFileName (0, Filename1); > > > > plod->setRange (0, 0.0f, 100.0f); > > > > plod->setFileName (1, Filename2); > > > > plod->setRange (1, 100.0f, 200.0f); > > > > plod->setFileName (2, Filename3); > > > > plod->setRange (2, 200.0f, 300.0f); > > > > plod->setFileName (3, Filename4); > > > > plod->setRange (3, 300.0f, 1000.0f); > > > > plod->setNumChildrenThatCannotBeExpired(1); > > > > root->addChild(plod); > > > > osgDB::writeNodeFile(*root, "/home/maximum2000/LABS/PLOD/osg/saved.osg"); > > > > > > > > But memory doesn't get free. As result, there is all the data in > > memory while watching all 4 LODs (from different distance). > > > > If a get it right, I need to use osgDB::DatabasePager to unload all > > "inactive" objects. > > > > Is that true? > > > > I've tried to do as follows: > > > > 1. Added the code: > > > > .... > > > > viewer = new osgViewer::Viewer(); > > > > dbPager = osgDB::DatabasePager::create(); > > > > dbPager->setCompileGLObjectsForContextID (0, true); > > > > dbPager->setDoPreCompile(true); > > > > viewer->getScene()->setDatabasePager(dbPager); > > > > 2. And appended the folloing string into the code from beginning of this > > message. > > > > ....... > > > > root->addChild(plod); > > > > dbPager->registerPagedLODs(plod) ; > > > > 3. Every frame is called by > > > > ...... > > > > viewer->getDatabasePager()->updateSceneGraph(*(viewer->getFrameStamp())); > > > > ..... > > > > But memory still doesn't get free. There is all the data, not only > visible. > > > > Did I understand everythig right? Why doesn't memory get free? > > > > > > > > Maxim Gammer > > > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Maxim Gammer
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

