Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control.

Fixes Bugzilla #697.

--HG--
branch : SDL-1.2
This commit is contained in:
Ryan C. Gordon
2009-09-29 13:50:33 +00:00
parent be9f35e228
commit 59601227a2
3 changed files with 10 additions and 2 deletions

View File

@@ -289,7 +289,9 @@ int X11_GL_CreateContext(_THIS)
if ( this->gl_data->glXSwapIntervalMESA ) {
this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control);
} else if ( this->gl_data->glXSwapIntervalSGI ) {
this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control);
if (this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control) != 0) {
this->gl_data->sgi_swap_interval = this->gl_config.swap_control;
}
}
}
#else
@@ -412,7 +414,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->glXGetSwapIntervalMESA ) {
*value = this->gl_data->glXGetSwapIntervalMESA();
return(0);
return 0;
} else if ( this->gl_data->glXSwapIntervalSGI ) {
*value = this->gl_data->sgi_swap_interval;
return 0;
} else {
unsupported = 1;
}

View File

@@ -75,6 +75,7 @@ struct SDL_PrivateGLData {
GLint (*glXSwapIntervalMESA) ( unsigned interval );
GLint (*glXGetSwapIntervalMESA) ( void );
int sgi_swap_interval;
#endif /* SDL_VIDEO_OPENGL_GLX */
};

View File

@@ -121,6 +121,8 @@ static SDL_VideoDevice *X11_CreateDevice(int devindex)
SDL_memset(device->hidden, 0, (sizeof *device->hidden));
SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
device->gl_data->sgi_swap_interval = 1;
/* Set the driver flags */
device->handles_any_size = 1;