[osg-users] Different views hide/show different nodes

Robert Osfield robert.osfield at gmail.com
Wed Apr 17 09:54:16 PDT 2019


Ho Catalin,

> I have an old application using OpengGL and I am porting it to OSG.
> I have one scene graph shared by multiple views. The problem is some views have some objects hidden.

You can use a combination of NodeMask's on the Nodes in your scene
graph, and TraversalMask associated with the Cameras on each View, you
can also set these TraversalMasks for any traversals you make into the
scene.  As a visitor traverses the scene the subgraph is traversed if
the (Node.getNodeMask() & visitor.getTraversalMask()) value is non
null.

This approach allows you to share the same scene graph between
different views but still have parts that render differently in each
view.  The osgstereimage example illustrates such an approach,
although in this instance for a left and right eye Camera traversal
rather than multiple views.  The general approach is the same, you
just set the cull traverasal mask for the different View Camera's as
you want them.

Robert.


More information about the osg-users mailing list