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; }