Hi Jason,

If you are sharing a database between multiple viewers that are
created/deleted then you'll need to switch off the
Texture::setUnrefImageAfterApply(bool) feature that is set to true by
default for paged databases.  The DatabasePager has a method for
controlling this, but I'm afraid I can't recall this off the top of my
head.  It's a topic that's been covered and number of times on
osg-users so have a poke through the archives.

Robert.

On Wed, Oct 14, 2009 at 6:17 PM, Jason Beverage <[email protected]> wrote:
> Hi all,
>
> I'm having an with creating and destroying multiple viewers that load a
> paged database.  I've put together a very simple example of this that
> creates a viewer to display a model, waits for it to complete, then creates
> another viewer.
>
> #include <osgDB/ReadFile>
> #include <osgViewer/Viewer>
>
> int main(int argc, char** argv)
> {
>    osg::ArgumentParser arguments(&argc,argv);
>
>    osgViewer::Viewer* viewer = new osgViewer::Viewer();
>    viewer->setUpViewInWindow(100,100,500,500);
>    osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
>    viewer->setSceneData( loadedModel.get() );
>    viewer->run();
>    delete viewer; //Comment out this line and things run fine.
>
>    viewer = new osgViewer::Viewer();
>    viewer->setUpViewInWindow(100,100,500,500);
>    loadedModel = osgDB::readNodeFiles(arguments);
>    viewer->setSceneData( loadedModel.get() );
>    viewer->run();
>    delete viewer;
> }
>
> If I load a simple model like cow.osg, things are ok except for the fact
> that the cow is white on the second run.  If I run using a paged database
> such as http://www.openscenegraph.org/data/earth_bayarea/earth.ive, the app
> crashes.
>
> This happens in the SVN trunk of OSG as well as the 2.8.2 release.  Is there
> something special that I need to do with the viewers when dealing with paged
> databases to clean things up correctly?
>
> Thanks,
>
> Jason
>
> _______________________________________________
> 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

Reply via email to