Time for action - rendering a flashing spotlight

The key to rendering dynamic textures is to provide multiple images as the source, and draw them one after another. These images can be obtained from a video file, or created by developers and artists. In the following example, we will create a series of spotlights with varying radii, and output them to osg::Image objects, and then attach them to the texture attribute using the osg::ImageSequence class to produce a flashing effect on a specific model.

  1. Include the necessary headers:
    #include <osg/ImageSequence>
    #include <osg/Texture2D>
    #include <osg/Geometry>
    #include <osg/Geode>
    #include <osgViewer/Viewer>
  2. The spotlight can be defined as a follow spot projecting a bright beam of light onto a space. ...

Get OpenSceneGraph 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.