diff --git a/source/examples/common/Context.cpp b/source/examples/common/Context.cpp index 95f1c013..8827098e 100644 --- a/source/examples/common/Context.cpp +++ b/source/examples/common/Context.cpp @@ -242,8 +242,26 @@ void Context::setSwapInterval(const SwapInterval interval) if (current != m_window) glfwMakeContextCurrent(m_window); +#ifdef WIN32 + + using SWAPINTERVALEXTPROC = bool(*)(int); + static SWAPINTERVALEXTPROC wglSwapIntervalEXT(nullptr); + + bool result(false); + if (!wglSwapIntervalEXT) + wglSwapIntervalEXT = reinterpret_cast(glbinding::getProcAddress("wglSwapIntervalEXT")); + if (wglSwapIntervalEXT) + result = wglSwapIntervalEXT(static_cast(interval)); + + if(!result) + warning("Setting swap interval to % failed.", swapIntervalString(interval)); + +#else + glfwSwapInterval(static_cast(interval)); +#endif + if (current != m_window) glfwMakeContextCurrent(current);