Skip to content
Permalink
Browse files

Added SDL_GL_STEREO for stereoscopic OpenGL contexts

  • Loading branch information
slouken committed Aug 19, 2002
1 parent 250f5cb commit 11d0bc47ab4e5dc187608b39ffd028acbb545fd1
@@ -16,6 +16,7 @@ <H2>
Major changes since SDL 1.0.0:
</H2>
<UL>
<LI> 1.2.5: Added SDL_GL_STEREO for stereoscopic OpenGL contexts
<LI> 1.2.5: Fixed VidMode error when running on XFree86 3.3
<LI> 1.2.5: Added initial support for PicoGUI (thanks Micah!)
<LI> 1.2.5: Fixed SDL_DisplayFormatAlpha() on RGB surfaces with alpha
@@ -215,7 +215,8 @@ typedef enum {
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO
} SDL_GLattr;

/* flags for SDL_SetPalette() */
@@ -295,13 +295,14 @@ struct SDL_VideoDevice {
int blue_size;
int alpha_size;
int depth_size;
int buffer_size;
int buffer_size;
int stencil_size;
int double_buffer;
int accum_red_size;
int accum_green_size;
int accum_blue_size;
int accum_alpha_size;
int accum_red_size;
int accum_green_size;
int accum_blue_size;
int accum_alpha_size;
int stereo;
int driver_loaded;
char driver_path[256];
void* dll_handle;
@@ -226,6 +226,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
video->gl_config.accum_green_size = 0;
video->gl_config.accum_blue_size = 0;
video->gl_config.accum_alpha_size = 0;
video->gl_config.stereo = 0;

/* Initialize the video subsystem */
memset(&vformat, 0, sizeof(vformat));
@@ -1370,18 +1371,21 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value )
case SDL_GL_STENCIL_SIZE:
video->gl_config.stencil_size = value;
break;
case SDL_GL_ACCUM_RED_SIZE:
case SDL_GL_ACCUM_RED_SIZE:
video->gl_config.accum_red_size = value;
break;
case SDL_GL_ACCUM_GREEN_SIZE:
case SDL_GL_ACCUM_GREEN_SIZE:
video->gl_config.accum_green_size = value;
break;
case SDL_GL_ACCUM_BLUE_SIZE:
case SDL_GL_ACCUM_BLUE_SIZE:
video->gl_config.accum_blue_size = value;
break;
case SDL_GL_ACCUM_ALPHA_SIZE:
case SDL_GL_ACCUM_ALPHA_SIZE:
video->gl_config.accum_alpha_size = value;
break;
case SDL_GL_STEREO:
video->gl_config.stereo = value;
break;
default:
SDL_SetError("Unknown OpenGL attribute");
retval = -1;
@@ -46,6 +46,9 @@ int Mac_GL_Init(_THIS)
if ( this->gl_config.double_buffer ) {
attributes[i++] = AGL_DOUBLEBUFFER;
}
if ( this->gl_config.stereo ) {
attributes[i++] = AGL_STEREO;
}
if ( this->gl_config.depth_size != 0 ) {
attributes[i++] = AGL_DEPTH_SIZE;
attributes[i++] = this->gl_config.depth_size;
@@ -1157,6 +1157,10 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) {
attr[i++] = NSOpenGLPFADoubleBuffer;
}

if ( this->gl_config.stereo ) {
attr[i++] = NSOpenGLPFAStereo;
}

if ( this->gl_config.stencil_size != 0 ) {
attr[i++] = NSOpenGLPFAStencilSize;
attr[i++] = this->gl_config.stencil_size;
@@ -1245,6 +1249,7 @@ static int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) {
case SDL_GL_ACCUM_GREEN_SIZE: attr = GL_ACCUM_GREEN_BITS; break;
case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_BITS; break;
case SDL_GL_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
case SDL_GL_STEREO: attr = GL_STEREO; break;
case SDL_GL_BUFFER_SIZE:
{
GLint bits = 0;
@@ -106,6 +106,9 @@ int WIN_GL_SetupWindow(_THIS)
if ( this->gl_config.double_buffer ) {
GL_pfd.dwFlags |= PFD_DOUBLEBUFFER;
}
if ( this->gl_config.stereo ) {
GL_pfd.dwFlags |= PFD_STEREO;
}
GL_pfd.iPixelType = PFD_TYPE_RGBA;
GL_pfd.cColorBits = this->gl_config.buffer_size;
GL_pfd.cRedBits = this->gl_config.red_size;
@@ -242,6 +245,13 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_ACCUM_ALPHA_SIZE:
*value = GL_pfd.cAccumAlphaBits;
break;
case SDL_GL_STEREO:
if ( GL_pfd.dwFlags & PFD_STEREO ) {
*value = 1;
} else {
*value = 0;
}
break;
default:
retval = -1;
break;
@@ -67,8 +67,8 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
}

/* Setup our GLX attributes according to the gl_config. */
i = 0;
attribs[i++] = GLX_RGBA;
i = 0;
attribs[i++] = GLX_RGBA;
attribs[i++] = GLX_RED_SIZE;
attribs[i++] = this->gl_config.red_size;
attribs[i++] = GLX_GREEN_SIZE;
@@ -82,8 +82,8 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
}

if( this->gl_config.buffer_size ) {
attribs[i++] = GLX_BUFFER_SIZE;
attribs[i++] = this->gl_config.buffer_size;
attribs[i++] = GLX_BUFFER_SIZE;
attribs[i++] = this->gl_config.buffer_size;
}

if( this->gl_config.double_buffer ) {
@@ -99,25 +99,30 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
}

if( this->gl_config.accum_red_size ) {
attribs[i++] = GLX_ACCUM_RED_SIZE;
attribs[i++] = GLX_ACCUM_RED_SIZE;
attribs[i++] = this->gl_config.accum_red_size;
}

if( this->gl_config.accum_green_size ) {
attribs[i++] = GLX_ACCUM_GREEN_SIZE;
attribs[i++] = GLX_ACCUM_GREEN_SIZE;
attribs[i++] = this->gl_config.accum_green_size;
}

if( this->gl_config.accum_blue_size ) {
attribs[i++] = GLX_ACCUM_BLUE_SIZE;
attribs[i++] = GLX_ACCUM_BLUE_SIZE;
attribs[i++] = this->gl_config.accum_blue_size;
}

if( this->gl_config.accum_alpha_size ) {
attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
attribs[i++] = this->gl_config.accum_alpha_size;
}

if( this->gl_config.stereo ) {
attribs[i++] = GLX_STEREO;
attribs[i++] = this->gl_config.stereo;
}

#ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
attribs[i++] = GLX_X_VISUAL_TYPE;
attribs[i++] = GLX_DIRECT_COLOR;
@@ -288,6 +293,9 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_ACCUM_ALPHA_SIZE:
glx_attrib = GLX_ACCUM_ALPHA_SIZE;
break;
case SDL_GL_STEREO:
glx_attrib = GLX_STEREO;
break;
default:
return(-1);
}

0 comments on commit 11d0bc4

Please sign in to comment.