Currently there are 3 user-settable flags that affect whether and how vtkRenderWindow does stereo rendering: StereoCapableWindow, StereoRender and StereoType. All are user settable and the biggest annoyance is that there’s an implicit order in which these flags need to be set for things to work e.g. vtkRenderWindow::SetStereoRender will ignore the requested value if this->StereoCapableWindow==false && this->StereoType == VTK_STEREO_CRYSTAL_EYES.
Thus assuming an active stereo capable environment, the following will fail:
renWin->SetStereoTypeToCrystalEyes();
renWin->StereoRenderOn(); /* gets ignored, generates warning */
renWin->StereoCapableWindowOn();
however, the following will pass:
renWin->StereoRenderOn(); /* successful */
renWin->StereoCapableWindowOn();
renWin->SetStereoTypeToCrystalEyes();
or the following too:
renWin->StereoCapableWindowOn();
renWin->SetStereoTypeToCrystalEyes();
renWin->StereoRenderOn(); /* successful */
My proposal is as follows:
- make
StereoCapableWindowa get-only variable. TheSetStereoCapableWindowAPI will become protected. Subclasses that create the OpenGL context can toggle the flag based on whether the context is stereo capable or not. -
SetStereoRenderflag will never ignore the value being set by the user. TheStereoRenderivar is what subclasses will use to create a context, if appropriate. If they can’t create a stereo context, they simply setStereoCapableWindowflag to false. - When doing the rendering,
vtkRenderWindowwill do active-stereo rendering only ofStereoRender == true && StereoCapableWindow == true && StereoType==VTK_STEREO_CRYSTAL_EYES. If VTK_STEREO_CRYSTAL_EYES was requested byStereoCapableWindow == false, we will generate a warning once.