The GLFW documentation says, and I quote:
Event processing must be done regularly while you have visible windows and is normally done each frame after buffer swapping.
There is no explanation of why event processing is “normally done each frame after buffer swapping.” I have thought about it and cannot quite justify that to myself, so I would like an explanation. To me, it seems only natural that callback functions for user input should work mostly by setting the values of variables that are examined each frame. Therefore it seems to me that although calling glfwWaitEvents after glfwSwapBuffers would make sense (you definitely should draw a frame before you go to sleep), if you are using glfwPollEvents then it is more logical to do it at the beginning of your loop, so that the user input events are processed before you examine the values of the variables set by the callback functions. What is the rationale for event processing being “normally done each frame after buffer swapping”?