Stereoscopic display

This tutorial demonstrates the stereoscopic capabilities of REDsdk with NVidia Quadro GPU (quad buffered OpenGL stereo).

There are several prerequisites for running this application:

The NVidia 3D Vision kit

For further details about the NVidia 3D Vision products, please go to the NVidia official page.

Enabling REDsdk stereroscopy

Stereoscopic display is automatically handled by REDsdk. No need to duplicate the viewpoints nor to write complex code. Therefore the tutorial scene is very simple:

At startup, the window must be created with the stereoscopic option enabled using a RED::WindowRenderInfo object. In the RFK framework, this option is transmitted to RED::Factory::CreateREDWindow via a parameter of the RFK::TutorialApplication::MainLoop function.

// Activate the stereo display at engine startup:
// This will be given to the RED::Factory::CreateREDWindow method.
RED::WindowRenderInfo winfo;
winfo.SetStereo( true );

// Run the application in default GPU loop mode.
return RFK::TutorialApplication::MainLoop( "Tutorial - Stereoscopy", RFK::LM_ACTIVE, 500.0, &winfo );

Note:

If your graphic card does not support stereoscopy, the function will most likely fail with the RED_DRV_NO_PIXEL_FORMAT error code.

Once the stereoscopy is enabled, we can control it in real-time using the RED::IViewpointRenderList::SetStereo function:

// Set the stereo parameters:
//  - Eye interpupillary distance: 5cm
//  - Convergence plane distance: 1m
RC_TEST( ivrl->SetStereo( 0.05f, 1.0f, iresmgr->GetState() ) );

The first parameter is the IPD (Inter Pupillar Distance) in scene units. Depending on people, it varies from 5cm to 7cm. The second parameter allows to adjust the convergence plane distance in the scene. The objects behind the plane will appear behind the screen. The objects in front of the plane will appear in front of the screen (see Stereoscopy for further details).

Note:

The camera near plane is set at the same distance as the stereo convergence plane. This ensures that the scene objects will not 'go out' of the screen and cross the screen borders.

And that's it! These only two functions allow to display any scene in stereoscopic 3D. Time to wear you 3D glasses!

Tutorial screen without stereo glasses