Skip to content

Commit

Permalink
Fixed bug #260
Browse files Browse the repository at this point in the history
Fixed SDL_GL_SWAP_CONTROL on Windows, and the query on Linux
  • Loading branch information
slouken committed Jun 24, 2006
1 parent 9ce0dd7 commit e9e6c15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 15 additions & 2 deletions src/video/wincommon/SDL_wingl.c
Expand Up @@ -346,7 +346,10 @@ int WIN_GL_SetupWindow(_THIS)
/* Uh oh, something is seriously wrong here... */
wglext = NULL;
}
if ( !wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
if ( wglext && SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
this->gl_data->wglSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT");
this->gl_data->wglGetSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT");
} else {
this->gl_data->wglSwapIntervalEXT = NULL;
this->gl_data->wglGetSwapIntervalEXT = NULL;
}
Expand Down Expand Up @@ -466,10 +469,12 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
break;
case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->wglGetSwapIntervalEXT ) {
return this->gl_data->wglGetSwapIntervalEXT();
*value = this->gl_data->wglGetSwapIntervalEXT();
return 0;
} else {
return -1;
}
break;
default:
return(-1);
}
Expand Down Expand Up @@ -533,6 +538,14 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_MULTISAMPLESAMPLES:
*value = 1;
break;
case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->wglGetSwapIntervalEXT ) {
*value = this->gl_data->wglGetSwapIntervalEXT();
return 0;
} else {
return -1;
}
break;
default:
retval = -1;
break;
Expand Down
5 changes: 3 additions & 2 deletions src/video/x11/SDL_x11gl.c
Expand Up @@ -401,9 +401,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
break;
case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->glXGetSwapIntervalMESA ) {
return this->gl_data->glXGetSwapIntervalMESA();
*value = this->gl_data->glXGetSwapIntervalMESA();
return(0);
} else {
return(-1)/*(this->gl_config.swap_control > 0)*/;
return(-1);
}
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion test/testgl.c
Expand Up @@ -834,7 +834,7 @@ int main(int argc, char *argv[])
}
if ( strncmp(argv[i], "-h", 2) == 0 ) {
printf(
"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n",
"Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel] [-sync] [-fullscreen]\n",
argv[0]);
exit(0);
}
Expand Down

0 comments on commit e9e6c15

Please sign in to comment.