
While it is necessary to process events in one or more of the ways above, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. glfwPollEvents, processes only those events that have already been received and then returns immediately.ĭo not assume that callbacks will only be called in response to the above functions. There are three functions for processing pending events. Even when you have no windows, event polling needs to be done in order to receive monitor and joystick connection events. Event processing is normally done each frame after buffer swapping. GLFW needs to poll the window system for events both to provide input to the application and to prove to the window system that the application hasn't locked up. It register every callback supported by GLFW and prints out all arguments provided for every event, along with time and sequence information.

To get a better feel for how the various events callbacks behave, run the events test program.

By using the window user pointer, you can access non-global structures or objects from your callbacks. Callbacks are more work to use than polling but is less CPU intensive and guarantees that you do not miss state changes.Īll input callbacks receive a window handle. While some can only be polled, like time, or only received via callbacks, like scrolling, many provide both callbacks and polling. There are also guides for the other areas of GLFW. For details on a specific function in this category, see the Input reference.

This guide introduces the input related functions of GLFW.
