Chapter 5

Fast dynamic casting

The asGroup() and asGeode() methods are virtual methods that could be re-implemented by subclasses such as osg::Group and osg::Geode. These methods actually don't do any runtime check and simply return NULL if not overridden, so they are always faster than dynamic_cast<>. The limitation here is that they only convert nodes into specify types, so if you are going to cast a certain node pointer to the osg::LOD type, use dynamic_cast<> instead:

osg::LOD* lod = dynamic_cast<osg::LOD*>(node);

Matrix multiplications

There is a website that excellently introduces the concepts here, as well as explains the reason why OSG does not use the column major and prefix notations that are introduced in OpenGL books: http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations ...

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.