Commit a05e8ec0 authored by Sam Lantinga's avatar Sam Lantinga

Added SDL_GL_STEREO for stereoscopic OpenGL contexts

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40451
parent 79fc2931
...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>. ...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
Major changes since SDL 1.0.0: Major changes since SDL 1.0.0:
</H2> </H2>
<UL> <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: Fixed VidMode error when running on XFree86 3.3
<LI> 1.2.5: Added initial support for PicoGUI (thanks Micah!) <LI> 1.2.5: Added initial support for PicoGUI (thanks Micah!)
<LI> 1.2.5: Fixed SDL_DisplayFormatAlpha() on RGB surfaces with alpha <LI> 1.2.5: Fixed SDL_DisplayFormatAlpha() on RGB surfaces with alpha
......
...@@ -215,7 +215,8 @@ typedef enum { ...@@ -215,7 +215,8 @@ typedef enum {
SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO
} SDL_GLattr; } SDL_GLattr;
/* flags for SDL_SetPalette() */ /* flags for SDL_SetPalette() */
......
...@@ -302,6 +302,7 @@ struct SDL_VideoDevice { ...@@ -302,6 +302,7 @@ struct SDL_VideoDevice {
int accum_green_size; int accum_green_size;
int accum_blue_size; int accum_blue_size;
int accum_alpha_size; int accum_alpha_size;
int stereo;
int driver_loaded; int driver_loaded;
char driver_path[256]; char driver_path[256];
void* dll_handle; void* dll_handle;
......
...@@ -226,6 +226,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags) ...@@ -226,6 +226,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
video->gl_config.accum_green_size = 0; video->gl_config.accum_green_size = 0;
video->gl_config.accum_blue_size = 0; video->gl_config.accum_blue_size = 0;
video->gl_config.accum_alpha_size = 0; video->gl_config.accum_alpha_size = 0;
video->gl_config.stereo = 0;
/* Initialize the video subsystem */ /* Initialize the video subsystem */
memset(&vformat, 0, sizeof(vformat)); memset(&vformat, 0, sizeof(vformat));
...@@ -1382,6 +1383,9 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value ) ...@@ -1382,6 +1383,9 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value )
case SDL_GL_ACCUM_ALPHA_SIZE: case SDL_GL_ACCUM_ALPHA_SIZE:
video->gl_config.accum_alpha_size = value; video->gl_config.accum_alpha_size = value;
break; break;
case SDL_GL_STEREO:
video->gl_config.stereo = value;
break;
default: default:
SDL_SetError("Unknown OpenGL attribute"); SDL_SetError("Unknown OpenGL attribute");
retval = -1; retval = -1;
......
...@@ -46,6 +46,9 @@ int Mac_GL_Init(_THIS) ...@@ -46,6 +46,9 @@ int Mac_GL_Init(_THIS)
if ( this->gl_config.double_buffer ) { if ( this->gl_config.double_buffer ) {
attributes[i++] = AGL_DOUBLEBUFFER; attributes[i++] = AGL_DOUBLEBUFFER;
} }
if ( this->gl_config.stereo ) {
attributes[i++] = AGL_STEREO;
}
if ( this->gl_config.depth_size != 0 ) { if ( this->gl_config.depth_size != 0 ) {
attributes[i++] = AGL_DEPTH_SIZE; attributes[i++] = AGL_DEPTH_SIZE;
attributes[i++] = this->gl_config.depth_size; attributes[i++] = this->gl_config.depth_size;
......
...@@ -1157,6 +1157,10 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) { ...@@ -1157,6 +1157,10 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) {
attr[i++] = NSOpenGLPFADoubleBuffer; attr[i++] = NSOpenGLPFADoubleBuffer;
} }
if ( this->gl_config.stereo ) {
attr[i++] = NSOpenGLPFAStereo;
}
if ( this->gl_config.stencil_size != 0 ) { if ( this->gl_config.stencil_size != 0 ) {
attr[i++] = NSOpenGLPFAStencilSize; attr[i++] = NSOpenGLPFAStencilSize;
attr[i++] = this->gl_config.stencil_size; attr[i++] = this->gl_config.stencil_size;
...@@ -1245,6 +1249,7 @@ static int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) { ...@@ -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_GREEN_SIZE: attr = GL_ACCUM_GREEN_BITS; break;
case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_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_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
case SDL_GL_STEREO: attr = GL_STEREO; break;
case SDL_GL_BUFFER_SIZE: case SDL_GL_BUFFER_SIZE:
{ {
GLint bits = 0; GLint bits = 0;
......
...@@ -106,6 +106,9 @@ int WIN_GL_SetupWindow(_THIS) ...@@ -106,6 +106,9 @@ int WIN_GL_SetupWindow(_THIS)
if ( this->gl_config.double_buffer ) { if ( this->gl_config.double_buffer ) {
GL_pfd.dwFlags |= PFD_DOUBLEBUFFER; GL_pfd.dwFlags |= PFD_DOUBLEBUFFER;
} }
if ( this->gl_config.stereo ) {
GL_pfd.dwFlags |= PFD_STEREO;
}
GL_pfd.iPixelType = PFD_TYPE_RGBA; GL_pfd.iPixelType = PFD_TYPE_RGBA;
GL_pfd.cColorBits = this->gl_config.buffer_size; GL_pfd.cColorBits = this->gl_config.buffer_size;
GL_pfd.cRedBits = this->gl_config.red_size; GL_pfd.cRedBits = this->gl_config.red_size;
...@@ -242,6 +245,13 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) ...@@ -242,6 +245,13 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_ACCUM_ALPHA_SIZE: case SDL_GL_ACCUM_ALPHA_SIZE:
*value = GL_pfd.cAccumAlphaBits; *value = GL_pfd.cAccumAlphaBits;
break; break;
case SDL_GL_STEREO:
if ( GL_pfd.dwFlags & PFD_STEREO ) {
*value = 1;
} else {
*value = 0;
}
break;
default: default:
retval = -1; retval = -1;
break; break;
......
...@@ -118,6 +118,11 @@ XVisualInfo *X11_GL_GetVisual(_THIS) ...@@ -118,6 +118,11 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
attribs[i++] = this->gl_config.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 */ #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
attribs[i++] = GLX_X_VISUAL_TYPE; attribs[i++] = GLX_X_VISUAL_TYPE;
attribs[i++] = GLX_DIRECT_COLOR; attribs[i++] = GLX_DIRECT_COLOR;
...@@ -288,6 +293,9 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) ...@@ -288,6 +293,9 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_ACCUM_ALPHA_SIZE: case SDL_GL_ACCUM_ALPHA_SIZE:
glx_attrib = GLX_ACCUM_ALPHA_SIZE; glx_attrib = GLX_ACCUM_ALPHA_SIZE;
break; break;
case SDL_GL_STEREO:
glx_attrib = GLX_STEREO;
break;
default: default:
return(-1); return(-1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment