When responses to window refresh take too long

Hi & welcome to the GLFW forums!

Please take a look at the example code in the documentation, along with the GLFW examples the GLFW CMake Starter. This shows the basics of a GLFW application.

From these you’ll notice that you don’t need to respond to “refresh” or “resize” callbacks - the application should run a render loop calling either glfwPollEvents if you want to animate/redraw without waiting for input or glfwWaitEvents if you want to wait for input before re-drawing.

You shouldn’t get flickering if your render time is longer than the refresh time, because OpenGL draws to a backbuffer whilst the front buffer is being displayed, then swaps these when glfwSwapBuffers is called.