Skip to content

Commit f1edb41

Browse files
committed
revert vsync for windows, since glfw does not work
1 parent 27cb308 commit f1edb41

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/examples/common/Context.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,26 @@ void Context::setSwapInterval(const SwapInterval interval)
242242
if (current != m_window)
243243
glfwMakeContextCurrent(m_window);
244244

245+
#ifdef WIN32
246+
247+
using SWAPINTERVALEXTPROC = bool(*)(int);
248+
static SWAPINTERVALEXTPROC wglSwapIntervalEXT(nullptr);
249+
250+
bool result(false);
251+
if (!wglSwapIntervalEXT)
252+
wglSwapIntervalEXT = reinterpret_cast<SWAPINTERVALEXTPROC>(glbinding::getProcAddress("wglSwapIntervalEXT"));
253+
if (wglSwapIntervalEXT)
254+
result = wglSwapIntervalEXT(static_cast<int>(interval));
255+
256+
if(!result)
257+
warning("Setting swap interval to % failed.", swapIntervalString(interval));
258+
259+
#else
260+
245261
glfwSwapInterval(static_cast<int>(interval));
246262

263+
#endif
264+
247265
if (current != m_window)
248266
glfwMakeContextCurrent(current);
249267

0 commit comments

Comments
 (0)