OpenGL window creation within a DLL - Possible threading problem
-
Okay first, I have an executable the loads several DLLs. One of these DLLs needs to create a window and set an openGL context. A second DLL, which gets placed in its own thread executes functions on the first DLL. The initial problem I had was that the window was being created upon loading of the first DLL, and when the second DLL called functions on it from it's own thread, the openGL context would not be valid. I fixed this by making sure the window was created by the second DLLs worker thread that calls all of its functions. So now, I can verify that all of my openGL calls are not failing, the problem though is that nothing is happening in the window itself. Right after the window is created it appears to hang. The cursor changes over it and it is no longer selectable. I can verify that the windows message proc is being called correctly and it does get to WM_CREATE. I can also verify that the program itself is not hanging as the calls are still being made. The only thing I can think of as the problem is that when the window is created it is launching it's own additional thread, and I am subsequently trying to make my GL calls within the wrong thread. First, does this sound like the problem, and if it is, is there a way to make the window launch within the same thread that created it? I have made sure that the HINSTANCE that is passed into CreateWindowEx is that of the DLL. I hope this makes sense as it is a little long winded. Any help is appreciated. Thanks, Dustin