Managing parent nodes

We have already learnt that osg::Group is used as the group node, and osg::Geode as the leaf node of a scene graph. Their methods were introduced in the last chapter, and are also used in this chapter. Additionally, both classes should have an interface for managing parent nodes.

OSG allows a node to have multiple parents, as will be explained later. In this section, we will first have a glimpse of parent management methods, which are declared in the osg::Node class directly:

  1. The method getParent() returns an osg::Group pointer as the parent node. It requires an integer parameter that indicates the index in the parent's list.
  2. The method getNumParents() returns the total number of parents. If the node has a single parent, this ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.