-
Book Overview & Buying
-
Table Of Contents
OpenSceneGraph 3.0: Beginner's Guide
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. A bounding box from (0, 0, 0) to (1, 1, 1) can be defined like this:
osg::BoundingBox bb( osg::Vec3(0, 0, 0), osg::Vec3(1, 1, 1) );
Note that osg::BoundingBox is not managed by the smart pointer, and neither is the bounding sphere class osg::BoundingSphere...
Change the font size
Change margin width
Change background colour