I was reading the GLFW docs and I noticed that number of functions are described as “only call from the main thread”. I’d like to know what that exactly means.
I’m on Linux and I’ve creating a program that:
- Starts with a main thread, let’s call it A.
- Spins a second thread, let’s call it B.
- In B, it initialized GLFW and opens a window and does some OpengGL.
- No GLFW or OpenGL calls are done from any other thread, but B.
Everything works! I’m definitely not running GLFW in the main thread, however, I’m running it in a single thread.
Now I’d like to know, which of these statements is true:
- I’m just lucky on Linux, this won’t work on Mac OS X.
- As long as you call GLFW and OpenGL from a single thread it’s fine.
- You can have a thread-per-contex/window, once you create a window in a thread X, all calls related to that window must be done in thread X.
Thank you very much,