[osg-users] Trigger some function when PagedLOD finishes openening a node

Robert Osfield robert.osfield at gmail.com
Sat Sep 10 09:36:54 PDT 2016

Hi Bruno,

You could possible use the ReadFileCllback for this purpose.  Have a
look through the archives for discussions on the different ways that
ReadFileCallback can be used.

However, I have to add the the DatabasePager is designed to dispatch
compile operations to the draw traversal to compile the newly loaded
subgraphs incrementally during each frame.  A newly loaded subgraph
isn't merged until all the GL objects in that subgraph have been
compiled.  This means you can't just switch off doing the rendering
loop and wait for things to load and just render one frame and expect
everything to merge right away.  This incremental compilation exists
to avoid frame drops.

One way around this pre compilation would be to simply switch off pre
compilation of subgraphs, this would be new subgraphs are merged in
the frame right after it has been loaded. However, this approach
increases the changes of a frame drop as the new data is rendered for
the first time.

There is support built into lazy update of the scene via the
osgViewer::ViewerBase::setRunFrameScheme(...) support for the the
osgViewer:::ViewerBase::ON_DEMAND option.  When this is set and you
use the Viewer::run() method the viewer will automatically only call
frame when events have happened, there are animations running or the
database requires a new frame to be done (including for the
incremental compilation.)   You could have a look at how this is
implemented if you want to do something similar, or just use it


On 10 September 2016 at 09:56, Bruno Oliveira
<bruno.manata.oliveira at gmail.com> wrote:
> Hello,
> I am using a PagedLOD engine, but I need to call some function I have every
> time the PagedLOD finished reading a Node and it is ready for rendering.
> This function I want to call is intended to trigger a draw/refresh action in
> my viewer, but I think this could be any function at all.
> How do I do that?
> Thank you
> _______________________________________________
> 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