[osg-users] Better data loading

Robert Osfield robert.osfield at gmail.com
Mon Sep 12 09:43:18 PDT 2016


Hi Valerian,

The PagedLOD/DatabasePager pairing is primarily written to support
paging of vis-sim databases, rather than just general loading of
databases in background threads.  These design/implementation is quite
specialized as it has to support tight performance metrics such as
avoiding frame drops, hitting a solid 60Hz, load balancing etc.

For general loading of databases you are probably best just
implementing your own scheme.  It needn't be complicated as much of
the infrastructure required already exists in the OSG - You have
osg::OperationQueue/OperationThread/Operation that can be used to run
the threads with where adding the custom load can be done just by
subclassing from osg::Operation and then adding it to the queue.  This
will then be called automatically from any OperationThread that you
attach the queue to.  All done in a thread safe way.

Merging of loading databases I'd do as part of the update phases of
the scene graph frame, but not as an update callback.  You can use the
 Viewer::addUpdateOperation(Operation*) method to add in an custom
operation that is called during the update phases of each new frame.
In this custom Operation you'd take all the subgraphs loaded by the
custom Database operations and then merge them in the appropriate
place to the main scene graph.

Have a look at the osgthreadedterrain example to see an example of
this in action.

Robert.





On 12 September 2016 at 16:13, Valerian Merkling <niarkoleptik at gmail.com> wrote:
> Hi,
>
> Reading this thread
> http://forum.openscenegraph.org/viewtopic.php?t=16128  scared me a little : I'm using a UpdateCallback to add node into my scene graph.
>
> I've no problem with it for know but my goal was to make a clean migration from openGL to OSG, so I would like to make it better.
>
> I'm looking at the DatabsaePager class to try to get what to do, but since I'm working on a old app, all the threaded data loading is already done, I just need to add those data to the scene graph, and I would like to know if the DatabasePager can also help me in this case.
>
> And another quick question : database pager seems to work a lot with paged LOD, and I'm using a lot of PagedLOD to hide/show if the camera is in a fixed range (and absolutely no data loading). Is that bad ? Could it slow down somethings ?
>
> Thank you!
>
> Cheers,
> Valerian
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68582#68582
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list