[SDL] Suggesting an OpenGL Stereo fix....

Elmar Krieger elmar.krieger at cmbi.kun.nl
Sat Nov 16 06:12:01 PST 2002


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.cmbi.nl/whatif ---=
============OOo====================
               () ()
              _/  /_




More information about the SDL mailing list