I find these functions can register a callback for event from hardware(maybe? I'm not sure).
Like following functions.
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);
I'm curious that how are these functions called. Does GLFW create a new thread by glfwInit
to loop these functions? Or does GLFW register some listeners to listen these event from different hardware?
The majority of the GLFW API is specified to only be used on the main thread (the thread that your application starts on). Every callback will be executed on this thread, within a call to glfwPollEvents
or glfwWaitEvents
. Your callbacks will never be executed on any other thread.
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