Implementing your own drawables

There are two very important virtual methods in the osg::Drawable pure class:

  • The computeBound() constant method computes the bounding box around the geometry, which will be used in the view frustum culling process to decide whether to cull the geometry or not
  • The drawImplementation() constant method actually draws the geometry with OSG and OpenGL calls

To customize a user-defined drawable class, you have to re-implement these two methods and add your own drawing code at the appropriate place.

The computeBound() constant method returns an osg::BoundingBox value as the geometry's bounding box. The simplest way to create a bounding box is to set its minimum and maximum extents, both of which are three-element vectors. ...

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.