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 (int interval) Sets the swap interval for the current context.
Once you've made your GL context current via glfwMakeContextCurrent() you can use glfwSwapInterval(0) to request that vsync be disabled: int main( int, char** ) { GLFWwindow* window; glfwInit(); window = glfwCreateWindow( 640, 480, "GLFW", NULL, NULL ); glfwMakeContextCurrent( window ); glfwSwapInterval( 0 ); ...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With