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