# Suggesting an OpenGL Stereo fix

**URL:** <https://discourse.libsdl.org/t/suggesting-an-opengl-stereo-fix/7743>\
**Category:** SDL Development\
**Created:** [November 16, 2002, 6:12am UTC](https://discourse.libsdl.org/t/suggesting-an-opengl-stereo-fix/7743 "2002-11-16T06:12:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elmar\_Krieger](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/58f4c7/32.png) [@Elmar\_Krieger](https://discourse.libsdl.org/u/Elmar_Krieger)\
**Post date:** [November 16, 2002, 6:12am UTC](https://discourse.libsdl.org/t/suggesting-an-opengl-stereo-fix/7743/1 "2002-11-16T06:12:01Z")

</div>

Hi!

Some weeks ago, Sam asked for feedback on the OpenGL stereo support.  
I am working with Linux, and it works, but there’s a problem:  
Virtually every program (including mine) needs to switch between stereo  
and normal display.  
This is currently not possible, because the flags set by  
SDL\_GL\_SetAttribute are only read the first time SDL\_SetVideoMode is  
called. Subsequent calls to SDL\_SetVideoMode simply resize the window.  
I am aware that a workaround would be to quit the video system and restart,  
but that’s a pain.

That’s why I suggest a simple additional flag for SDL\_SetVideoMode:  
SDL\_RECREATE.  
If this one is set, the window is always recreated instead of resized,  
and the SDL\_GL\_Attributes are automatically considered.

Two little changes are required:

In SDL\_video.h:

/\* Available for SDL\_SetVideoMode() _/  
 #define SDL\_ANYFORMAT 0x10000000 /_ Allow any video depth/pixel-format _/  
 #define SDL\_HWPALETTE 0x20000000 /_ Surface has exclusive palette \*/

becomes

/\* Available for SDL\_SetVideoMode() _/  
 #define SDL\_RECREATE 0x8000000 /_ Recreate window, do not just resize (GL Stereo) _/  
 #define SDL\_ANYFORMAT 0x10000000 /_ Allow any video depth/pixel-format _/  
 #define SDL\_HWPALETTE 0x20000000 /_ Surface has exclusive palette \*/

In SDL\_x11video.c:

/\* Set up the X11 window \*/  
saved\_flags = current-\>flags;  
if (SDL\_Window && (saved\_flags&SDL\_OPENGL) == (flags&SDL\_OPENGL)  
&& bpp == current-\>format-\>BitsPerPixel ) {

becomes

/\* Set up the X11 window \*/  
saved\_flags = current-\>flags;  
if (SDL\_Window && (saved\_flags&SDL\_OPENGL) == (flags&SDL\_OPENGL)  
&& bpp == current-\>format-\>BitsPerPixel && !(flags&SDL\_RECREATE) ) {

Note that the same change must be made for the other operating systems!  
Is that OK or did I miss any obvious and easy solutions?

CU,  
Elmar

```
            Ww
          c(@@)c

```

================()==OUu============  
=WHAT IF YASARA knows the answer?!=  
=----- [http://www.yasara.com](http://www.yasara.com) -----=  
=— [http://www.cmbi.nl/whatif](http://www.cmbi.nl/whatif) —=  
============OOo====================  
() ()  
_/ /_
