Tuesday, October 30, 2012

Trivial CMAKE for OpenSceneGraph

It is often fun to get open source projects working with Visual Studio since a lot of build systems leave out a few Microsoft specific vagaries. With CMAKE life in the last few years has become much easier, though sometimes it requires a bit of digging to locate the right incantations to pull in the right dependencies for a trivial project.


SET(TARGET_SRC aeroviewer.cpp )

find_package(OpenSceneGraph REQUIRED osgDB osgUtil osgGA osgViewer osgText)



The aim of this quick dash is to add a screen overlay with the company logo to the default osgViewer. This requires adding a geometry node to the scene with some static geometry in camera space. Which ends up being equivalent to a HUD in osg parlance. After a bit of tweaking and rotations in texture space I got this, not too bad for a cold-start in OSG land. This bit of sample code is better for HUD's than the tutorial, the required projection and modelview matrices are encapsulated by the CameraNode.

No comments: