AFAIK, you need to check if the node have been loaded before making the request to DatabasePager. There are plenty of ways to do this, but here's one:
osgDB::DatabasePager* databasePager = osgDB::Registry::instance()->getOrCreateDatabasePager();
databasePager->setDoPreCompile(true); // Force precompilation.
osg::ref_ptr<osg::Group> root = new osg::Group();
viewer.setSceneData(root.get());
osg::ref_ptr<osg::Group> loaderGroup = new osg::Group();
root->addChild ( loaderGroup.get() );
viewer.realize();
while( !viewer.done() )
{
viewer.sync();
if ( ! loaderGroup->getNumChildren() )
databasePager->requestNodeFile(filePath, loaderGroup.get(), 0.0, viewer.getFrameStamp());
viewer.update();
viewer.frame();
}
Regards,
Paul
Paul de Repentigny
Graph Synergie Inc.
tel: (418) 659-5611 #103
derep a.t. graphsynergie.com
On 29-Jun-06, at 4:46 AM, Joakim Simonsson wrote:
På Thu, 29 Jun 2006 10:24:52 +0200, skrev Robert Osfield <[EMAIL PROTECTED]>:
Hi Joakim,
I'm afraid I can't delve too deep in users problems, I'm very busy. I
have time to point people in roughly the right direction, but if the
route is uncharted by me then I'm afraid I can't much in the way of
quick wisdom.
I am very grateful for the good and quick support you and everybody else give me here on the osg mailing list. Thanks Robert!
I thought this would interest you, since it seems that the databasepager isn't working as expected.
Can anyone else see if I use the database pager as intended?
Here's what the test program mainly do:
osgDB::DatabasePager* databasePager = osgDB::Registry::instance()->getOrCreateDatabasePager();
databasePager->setDoPreCompile(true); // Force precompilation.
osg::ref_ptr<osg::Group> root = new osg::Group();
viewer.setSceneData(root.get());
viewer.realize();
while( !viewer.done() )
{
viewer.sync();
// Continously request our model file.
databasePager->requestNodeFile(filePath, root.get(), 0.0, viewer.getFrameStamp());
viewer.update();
viewer.frame();
}
It seems that I have to write my own database pager, since this approach isn't working. :(
Well I have now made a small test app. dbpagerviewer.cpp. It behaves very
strange. Have I made a mistake in my code, or is it a bug in osg?
See the two attached diagrams. The diagrams show the framerate and the
number of texture objects loaded into video memory. osgviewer.png shows
how it looks like when loading a model with 126 different textures with
osgViewer.exe. No mystery here.
The dbpager.png diagram, illustrates what happens when I load the same
model with the dbpagerviewer test app. When the model appears in the
viewer (at the red vertical line) it seems that it is loaded again, and
again, and so on.
--
Joakim Simonsson
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
