Skip to content

Commit b2c3b49

Browse files
jas-perrevmischa
authored andcommitted
use updates synchronized with vertical retrace if adaptive vsync fails
1 parent 15caaae commit b2c3b49

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/projectM-sdl/projectM_SDL_main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,11 @@ srand((int)(time(NULL)));
306306
SDL_SetWindowTitle(win, "projectM Visualizer");
307307

308308
SDL_GL_MakeCurrent(win, glCtx); // associate GL context with main window
309-
SDL_GL_SetSwapInterval(-1); // Enable adaptive vsync
309+
int avsync = SDL_GL_SetSwapInterval(-1); // try to enable adaptive vsync
310+
if (avsync == -1) { // adaptive vsync not supported
311+
SDL_GL_SetSwapInterval(1); // enable updates synchronized with vertical retrace
312+
}
313+
310314

311315
projectMSDL *app;
312316

0 commit comments

Comments
 (0)