glfwSwapInterval source vs binaries

Hello everyone,

I know this question has been brought up before, sorry in advance, but I just can’t seem to make it work and I spent a lot of time googling and trying different stuff. So as a last resort I’m just going to ask it here (again) and hope for the best!

I noticed that the glfwSwapInterval() function in my C++ program was ignored when I linked against the GLFW static library I compiled from source using the cmake GUI → visual studio route. When I used the static library from the binaries, however, it worked fine and I was able to control my framerate with the glfwSwapInterval() function. So I’m wondering if there is a specific option I missed when I built from source. Well it must be, but I am pretty new to this whole cmake thing and already happy that I know how to configure (cmake gui) → generate (cmake gui) → build (visual studio 2019). I was hoping someone could explain to me the steps I should take to build it properly from source?

I’m on a laptop with hybrid GPU (intel UHD 630 / nvidia 1660 Ti), I don’t know if you guys need more information but of course I’m happy to provide any info necessary.

Kind regards,


When you link to static glfw library you have an option to force optimus system like yours to choose nvidia over intel gpu. This is controlled by cmake GLFW_USE_HYBRID_HPG setting. Maybe you turned that on? If this setting is on then your binary will use nvidia GPU, and if you have forcefully turned off vsync in nvidia control panel, it will ignore glfwSwapInterval calls.

By default this setting is not enabled in cmake builds, so maybe in case of pre-built static library your binary chose to use intel gpu with vsync enabled?

Check your glGetString(GL_VENDOR) to verify on which GPU you’re running.

You can always enable opengl to choose high power GPU option if you put this code in your C/C++ code for executable binary: glfw/win32_init.c at master · glfw/glfw · GitHub