Hi Danny,

On Fri, Feb 12, 2010 at 10:30 AM, Danny Lesnik <[email protected]> wrote:
> Can anybody help me how can I run osgDB::ReadNodeFile in separate Thread? I'm 
> loading huge 3ds model and I don't want to keep my window frozen till the 
> model is opened.

The OSG has in inbuilt DatabasePager that supports reading 3d models
in one or more background threads.  To use it you have to place a
PagedLOD or ProxyNode in your scene graph, these contains the details
of your external file request.   Then in the cull traversal will
automatically place the external file requests with the DatabasePager
that will load them and merge them all with the scene graph
automatically.  In you case ProxyNode is probably the one you want to
use.

The other alternative is implement your own threading for it by using
OpenThreads::Thread, or osg::OperationThread.  It will require you to
sync the main thread with your thread to make the request of the file
load and to merge the the data.  The osgterrain example has code that
does this but it also does lots beside so would be rather an overkill
example.

Most likely just using ProxyNode will get you what you want.  Just put
one of these in your scene graph and specify the external reference.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to