Chapter 3

Configuring OSG path options yourselves

OSG_INCLUDE_DIR can be set to the include directory in the installation folder. OSG_LIBRARY must be set to the osg library (for example, osg.lib under Windows). Here, OSG_LIBRARY_DEBUG means the debug version (always with a postfix of "d", for example, osgd.lib). Others may be deduced by analogy.

Release a smart pointer

If the target object is not referenced by any other element before returning from the function, it will actually be deleted at the end of the function because the local osg::ref_ptr<> variable is out of scope. That makes the returned pointer invalid. The release() method solves the problem here. However, if you have some other element whose life is beyond the function referencing target ...

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.