When to call CreateWindow in multithreaded app?

I nearly finished my first multithreaded OpenGL application, but one question still remains:

Does it matter which thread makes the CreateWindow call?
Must CreateWindow be called from the same thread that later creates the rendering context based on the resulting window handle?

At the moment another than the rendering thread makes that call and passes the HWND to the rendering thread (which creates its OpenGL context).
All is working fine, but I’m not sure if this is just luck :stuck_out_tongue:

No. The only restriction is that the OpenGL context is current to a thread. This means, when you call glMakeCurrent, all GL commands called in this thread work with the particular context. It does not matter in which thread the window or the context were created. You can even rebind a context to another thread if you wish.

Thanks Zengar, I feel better now :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.