From b80fcf18ab968b20a4b30aacb113cfc4b9472505 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 22 Apr 2022 14:20:26 +0200 Subject: [PATCH] GL: use adaptive vsync by default This seems to be better default behavior. Moreover it does behave more nicely when resizing windows in Wayland (with Wayland GLFW backend). --- src/video_display/gl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_display/gl.cpp b/src/video_display/gl.cpp index f903fc973..64d0e75b2 100644 --- a/src/video_display/gl.cpp +++ b/src/video_display/gl.cpp @@ -88,6 +88,7 @@ #define DEFAULT_WIN_NAME "Ultragrid - OpenGL Display" #define MAX_BUFFER_SIZE 1 +#define ADAPTIVE_VSYNC -1 #define SYSTEM_VSYNC 0xFE #define SINGLE_BUF 0xFF // use single buffering instead of double @@ -253,7 +254,7 @@ struct state_gl { time_ns_t t0 = get_time_in_ns(); - int vsync = 1; + int vsync = ADAPTIVE_VSYNC; bool paused = false; enum show_cursor_t { SC_TRUE, SC_FALSE, SC_AUTOHIDE } show_cursor = SC_AUTOHIDE; chrono::steady_clock::time_point cursor_shown_from{}; ///< indicates time point from which is cursor show if show_cursor == SC_AUTOHIDE, timepoint() means cursor is not currently shown