Add support for (GLX|WGL)_EXT_swap_control_tear.
This required a small public API change: SDL_GL_SetSwapInterval() now accepts negative values, and SDL_GL_GetSwapInterval() doesn't report errors anymore (if it can't work, it'll return zero as a reasonable default). If you need to test for errors, such as a lack of swap_control_tear support, check the results of SDL_GL_SetSwapInterval() when you set your desired value.
This commit is contained in:
parent
706ea79345
commit
2cd5fc4e97
10 changed files with 67 additions and 52 deletions
|
@ -240,18 +240,21 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
/* try late-swap-tearing first. If not supported, try normal vsync. */
|
||||
if (SDL_GL_SetSwapInterval(-1) == -1) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
}
|
||||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
SDL_GL_SetSwapInterval(0); /* disable vsync. */
|
||||
}
|
||||
|
||||
SDL_GetCurrentDisplayMode(0, &mode);
|
||||
printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
|
||||
printf("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format));
|
||||
printf("Swap Interval : %d\n", SDL_GL_GetSwapInterval());
|
||||
printf("\n");
|
||||
printf("Vendor : %s\n", glGetString(GL_VENDOR));
|
||||
printf("Renderer : %s\n", glGetString(GL_RENDERER));
|
||||
printf("Version : %s\n", glGetString(GL_VERSION));
|
||||
printf("Extensions : %s\n", glGetString(GL_EXTENSIONS));
|
||||
printf("Vendor : %s\n", glGetString(GL_VENDOR));
|
||||
printf("Renderer : %s\n", glGetString(GL_RENDERER));
|
||||
printf("Version : %s\n", glGetString(GL_VERSION));
|
||||
printf("\n");
|
||||
|
||||
status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue