From 5061d29926e54cdf7c02d1f92eec9193edbfcee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Apr 2016 11:19:30 +0200 Subject: [PATCH] Platform: don't set swap inteval implicitly in GlfwApplication. --- src/Magnum/Platform/GlfwApplication.cpp | 5 ++++- src/Magnum/Platform/GlfwApplication.h | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index cad349cb0..9bcd6dbe1 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -136,7 +136,6 @@ bool GlfwApplication::tryCreateContext(const Configuration& configuration) { glfwSetScrollCallback(_window, staticMouseScrollEvent); glfwMakeContextCurrent(_window); - glfwSwapInterval(1); /* Return true if the initialization succeeds */ return _context->tryCreate(); @@ -147,6 +146,10 @@ GlfwApplication::~GlfwApplication() { glfwTerminate(); } +void GlfwApplication::setSwapInterval(const Int interval) { + glfwSwapInterval(interval); +} + int GlfwApplication::exec() { while(!glfwWindowShouldClose(_window)) { if(_needsRedraw) { diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index fff11ee14..3315a4185 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -173,6 +173,14 @@ class GlfwApplication { */ void swapBuffers() { glfwSwapBuffers(_window); } + /** + * @brief Set swap interval + * + * Set `0` for no VSync, `1` for enabled VSync. Some platforms support + * `-1` for late swap tearing. Default is driver-dependent. + */ + void setSwapInterval(Int interval); + /** @copydoc Sdl2Application::redraw() */ void redraw() { _needsRedraw = true; }