mirror of
https://github.com/yawut/SDL.git
synced 2026-09-08 17:16:19 -05:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user