# Changing stereo-related flags

**URL:** https://discourse.vtk.org/t/changing-stereo-related-flags/477
**Category:** Development
**Tags:** proposal
**Created:** [March 13, 2019, 3:40pm UTC](https://discourse.vtk.org/t/changing-stereo-related-flags/477 "2019-03-13T15:40:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [March 13, 2019, 3:40pm UTC](https://discourse.vtk.org/t/changing-stereo-related-flags/477/1 "2019-03-13T15:40:14Z")

</div>

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:

```auto
renWin->SetStereoTypeToCrystalEyes();
renWin->StereoRenderOn(); /* gets ignored, generates warning */
renWin->StereoCapableWindowOn();

```

however, the following will pass:

```auto
renWin->StereoRenderOn(); /* successful */
renWin->StereoCapableWindowOn();
renWin->SetStereoTypeToCrystalEyes();

```

or the following too:

```auto
renWin->StereoCapableWindowOn();
renWin->SetStereoTypeToCrystalEyes();
renWin->StereoRenderOn(); /* successful */

```

My proposal is as follows:

1. make `StereoCapableWindow` a get-only variable. The `SetStereoCapableWindow` API will become protected. Subclasses that create the OpenGL context can toggle the flag based on whether the context is stereo capable or not.
2. `SetStereoRender` flag will never ignore the value being set by the user. The `StereoRender` ivar is what subclasses will use to create a context, if appropriate. If they can’t create a stereo context, they simply set `StereoCapableWindow` flag to false.
3. When doing the rendering, `vtkRenderWindow` will do active-stereo rendering only of `StereoRender == true && StereoCapableWindow == true && StereoType==VTK_STEREO_CRYSTAL_EYES`. If VTK\_STEREO\_CRYSTAL\_EYES was requested by `StereoCapableWindow == false`, we will generate a warning **once**.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [March 13, 2019, 9:05pm UTC](https://discourse.vtk.org/t/changing-stereo-related-flags/477/2 "2019-03-13T21:05:32Z")

</div>

Sounds reasonable to me. The ordering of the calls should not give different results.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [March 14, 2019, 9:00am UTC](https://discourse.vtk.org/t/changing-stereo-related-flags/477/3 "2019-03-14T09:00:36Z")

</div>

+1

---

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [March 14, 2019, 10:59am UTC](https://discourse.vtk.org/t/changing-stereo-related-flags/477/4 "2019-03-14T10:59:15Z")

</div>

I’ll create an MR. I may opt for a new var name instead of `StereoCapableWindow` just so that there is clear distinction between old usage and the new.
