glfwSwapInterval(1)
doesn't seem to be working for me. If I force VSync in CCC or setVerticalSyncEnabled(true)
in SFML my fps drops to 60, but GLFW just keeps running at 9000 fps. Am I going about this the wrong way or is GLFW bugged?
glfwSwapInterval(1) fails to enable vsync?
Well looks like GLFW doesn't want to turn VSync on when desktop compositing is enabled. If you want VSync anyway this will work on Windows:
#ifdef _WIN32
// Turn on vertical screen sync under Windows.
// (I.e. it uses the WGL_EXT_swap_control extension)
typedef BOOL (WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if(wglSwapIntervalEXT)
wglSwapIntervalEXT(1);
#endif
For other OSs google will help you.
This fix did not work on my Intel HD 4600, as the proc address was 0. But configuring GLFW3 to use GLFW_USE_DWM_SWAP_INTERVAL did. –
Pigeon
Rebuild GLFW3 with the GLFW_USE_DWM_SWAP_INTERVAL option.
See glfw/src/config.h
The GLFW docs warn about jitter problems, but I don't see those myself.
With release 3.1.2 this flag was removed; however, the fix is also in, so it isn't needed any longer :) –
Jacklin
Found that glfwSwapInterval needed calling again after changing between window and full screen mode, otherwise the framerate would be massive.
if (fullScreen)
{
glfwSetWindowMonitor(window, monitor, 0, 0, monitorMode->width, monitorMode->height, monitorMode->refreshRate);
// Added to fix framerate to vertical refresh //
glfwSwapInterval(1);
}
else
{
glfwSetWindowMonitor(window, NULL, 0, 0, monitorMode->width, monitorMode->height, monitorMode->refreshRate);
}
© 2022 - 2024 — McMap. All rights reserved.
glfwSwapInterval
not working on some ATI drivers. I've never used GLFW, but could you perhaps try directly calling(PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT")
? – BrainwashwglSwapIntervalEXT
works for some reason... So GLFW is bugged? – DairyingwglSwapIntervalEXT
works it sure means it has something to do with GLFW. You could try downloading the GLFW source, compile your program alongside with it and put a breakpoint @ line 831 window.c and line 1638 win32_window.c to see whats really happening. It could be one of those if checks failing. – Brainwash_glfwIsCompositionEnabled()
returns true. Oh well gotta do it manually then. Thanks :) – Dairying