Time for action—creating an HUD camera

A head-up display (HUD) can render data without requiring users to look away from their usual viewpoints. It is widely used in 3D scenes, for displaying important 2D texts, computer game statistics, and flight and cockpit instruments. This time, we are going to design an HUD camera, which contains a model that should be placed in front of other scene objects at any time.

  1. Include the necessary headers:
    #include <osg/Camera>
    #include <osgDB/ReadFile>
    #include <osgViewer/Viewer>
    
  2. Two models are loaded from disk files. lz.osg is used as a demo terrain, and glider.osg will be put under an HUD camera. That is, it will always be visible to viewers who are looking ahead; no matter how other parts of the scene graph ...

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.