Skip to content
Permalink
Browse files

Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_…

…control.

  Fixes Bugzilla #697.
  • Loading branch information
icculus committed Sep 29, 2009
1 parent 48556b2 commit c2b5cdcef2e70b493559398e222e380743a811af
Showing with 10 additions and 2 deletions.
  1. +7 −2 src/video/x11/SDL_x11gl.c
  2. +1 −0 src/video/x11/SDL_x11gl_c.h
  3. +2 −0 src/video/x11/SDL_x11video.c
@@ -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;
}
@@ -75,6 +75,7 @@ struct SDL_PrivateGLData {
GLint (*glXSwapIntervalMESA) ( unsigned interval );
GLint (*glXGetSwapIntervalMESA) ( void );

int sgi_swap_interval;
#endif /* SDL_VIDEO_OPENGL_GLX */
};

@@ -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;

0 comments on commit c2b5cdc

Please sign in to comment.