Skip to content

Commit

Permalink
Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_…
Browse files Browse the repository at this point in the history
…control.

  Fixes Bugzilla #697.
  • Loading branch information
icculus committed Sep 29, 2009
1 parent 48556b2 commit c2b5cdc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/video/x11/SDL_x11gl.c
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11gl_c.h
Expand Up @@ -75,6 +75,7 @@ struct SDL_PrivateGLData {
GLint (*glXSwapIntervalMESA) ( unsigned interval );
GLint (*glXGetSwapIntervalMESA) ( void );

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

Expand Down
2 changes: 2 additions & 0 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -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;

Expand Down

0 comments on commit c2b5cdc

Please sign in to comment.