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
StereoCapableWindow
a get-only variable. TheSetStereoCapableWindow
API will become protected. Subclasses that create the OpenGL context can toggle the flag based on whether the context is stereo capable or not. -
SetStereoRender
flag will never ignore the value being set by the user. TheStereoRender
ivar is what subclasses will use to create a context, if appropriate. If they can’t create a stereo context, they simply setStereoCapableWindow
flag to false. - When doing the rendering,
vtkRenderWindow
will 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.