In one of the products I develop at work, we’re using pbuffers for RTT functionality (and keeping OpenGL requirements minimal).
I’ve had this pbuffer code working quite well for months now, however it’s just recently I’ve started to use this code in a multi-threaded programming environment.
Specifically, the problem I’m having is - if I create the hidden window & opengl context for the pbuffer in Thread A, I cannot destroy/bind it to Thread B.
I’m properly handling device context & OpenGL context management, and Thread A has released/unmade-current both the window & pbuffer DCs, as well as the OpenGL context (eg: DCs have been released, and Thread A has no OpenGL context current).
Yet Thread B still fails to obtain a valid DC to the hidden window, thus Thread B can’t bind the OpenGL context either…
This is currently causing issues as our code-base assigns arbitrary threads to arbitrary jobs, and we can’t guarantee that the context/window will be created/destroyed in the same thread.
Am I right to assume it’s not even remotely possible to create a window/glcontext in one thread, and use/destroy it in another?
Thanks in advance,
P.S. there’s nothing special about how I create the hidden window & context, just the plain old RegisterClass/CreateWindow/ChoosePixelFormat/SetPixelFormat/wglCreateContext.