Time for action—rendering anaglyph stereo scenes

We are going to make use of OSG's internal anaglyph stereo mode to implement a simple and quick stereoscopic 3D effect. Before starting programming and rendering the scene, we have to prepare a pair of 3D red/cyan glasses to view the result correctly:

Time for action—rendering anaglyph stereo scenes

In most cases, the left eye of the glasses is red, and the right eye is cyan. This is the most commonly-used anaglyph effect, with limited color perception.

  1. Include the necessary headers:
    #include <osgDB/ReadFile>
    #include <osgViewer/Viewer>
    
  2. We will directly work on the global display settings. There are three steps to follow: switch the stereo mode to ...

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.