Added SDL_GL_STEREO for stereoscopic OpenGL contexts
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40451
This commit is contained in:
parent
79fc29317c
commit
a05e8ec098
8 changed files with 51 additions and 18 deletions
|
@ -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:
|
||||
</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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue