[osg-users] Mutliple viewers with multiple scenes

Robert Osfield robert.osfield at gmail.com
Mon Mar 7 07:18:12 PST 2016

HI Sebastian,

osgDB::Registry is written to handle multi-threading, not all plugins are
thread safe but the mains one will be with the latest rev of the OSG.

As a general approach, if you want multiple View's which have their own or
share Scene's then the appropriate class to use is CompositeViewer as it's
written specifically for this purpose.

When sharing a scene graph the osgViewer library automatically assigns an
osgViewer::Scene for each unique scene graph, while sharing the Scene if
you assign that scene graph to multiple View's.  The Scene holds the
DatabasePager for that scene graph so there isn't any overlap with multiple
pagers trying to load stuff for the scene graph in an uncoordinated way.

One way that could break this mechanism is sharing portions of the scene
graph and assigning the subgraph to each View as the Scene won't pick up on
the fact that it's the same overall scene graph.  If you have this
situationist then sharing the same complete scene graph and use a
combination of NodeMask and TraversalMask for each View to make sure on the
part you want visible in each View is seen.


On 7 March 2016 at 15:04, Sebastian Messerschmidt <
sebastian.messerschmidt at gmx.de> wrote:

> Hi,
> I've got some abnormal usage-pattern of viewers and scenes in one
> application.
> There is some Qt-based application using OSG to render different scenes
> into individual widgets(which use an osgViewer::Viewer), which kind of
> works.
> The problem is mainly due to osgDB::Registry being a singleton and
> therefore some facilities* shared between the viewers.
> I was thinking about moving to a CompositeViewer, but I'm uncertain if I
> should with having totally different scenes in the viewers. Is there some
> better way to display multiple widgets with different scenes in one
> OSG-application?
> *For instance the ReadFileCallbacks and the DatabasePager seem to be
> affected.
> Cheers
> Sebastian
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160307/392d5aae/attachment-0002.htm>

More information about the osg-users mailing list