Colin Branch wrote on Friday, December 14, 2007 10:30 AM:
> Hi all,
> 
> What I'm trying to do:
> Asynchronous model loading using OSG 2.2
> 
> How I'm currently doing it:
> I'm trying to use the Database Pager's requestNodeFile.
> 
> I created a new node class that I can add (as well as place temporary
> objects) that I can add and will stay in the scene.
> 
> class DtDelayedModelNode : public osg::Group
> {
> ...
> DtDelayedModelNode(const std::string& filename, osgDB::DatabasePager*
> pager) : osg::Group()
> {
>     osg::FrameStamp fs;
>     fs.setFrameNumber(INT_MAX);
>     pager->requestNodeFile(filename,this,1.0,&fs);
> }
> ...
> };

I'm not sure what you're trying to do. It looks like you just want to be
able to load a file when needed rather than right away. Couldn't you
just use osg::ProxyNode or osg::PagedLOD?

> What if any calls should I make to the pager around frame() (ie it
> doesn't appear that startFrame endFrame are needed, any other calls)?

If you are using osgViewer or osgProducer, then everything should happen
automatically; they do all the necessary DatabasePager handling for you.

> The value of the frame stamp appears to control deletion of requests.
> Ie if I pass in the current frame stamp, the model is actually
> deleted in compileGLObjects. Unless I set it to some value in the
> future (currently using INT_MAX) I can't guarantee it will load.
> Could someone explain the purpose of the framestamp and the proper
> usage? 

You don't actually need to pass in a FrameStamp, but if you do, then the
DatabasePager uses it to see how long it's been since the last time a
particular file was requested. If it's been too many frames since the
file request, then the DatabasePager assumes the request is out of date
and discards it. Note also that this behavior is dependent on startFrame
and endFrame.

> Is there anyway to get status feedback while a file loads?

Not at present.

-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to