Open aorandexiaohai opened 2 years ago
Have you measured and found this to be a problem?
You can render in a separate thread and have the main thread be solely for event processing, but the effects of any input would still need to be rendered after the input was received.
@elmindreda
Are you sure that this method is adopted by glfw?
It seems that the render thread and GUI thread are the same thread.
The example you gave is single-threaded. The common multi-threaded approach is to process events on the main thread and, while rendering and buffer swapping is done in a separate thread.
See the threads test program for an example of this.
@elmindreda Maybe my description is not clear or you misunderstand me.
I think that glfw can response to keyboard/mouse events quickly when running the above code. But I think that it is impossible. So, I want to know about the implementation mechanism.
I am doubting about the underlying mechanism of GLFW. The common pattern that use GLFW:
This is an endless loop. I think that it is difficult to response to window events quickly.