I am trying to initialize my OGL stuff from within the InitInstance function of a DLL I’ve created. Is this allowed?
I don’t know, but there’s every chance that it’s really not a good idea. You’ll have to create a window, and I doubt that Microsoft suggests doing that in DLL initialization.
DLL initialization should be fast. It should do basic stuff necessary to make the DLL’s code function (like initializing static variables and such). It’s probably not a good idea to be performing heavy-weight operations like window creation, connecting to internet sockets, or OpenGL context generation.
I did some light Googling (“InitInstance DLL”) and I found that calling LoadLibrary (and therefore calling anything that eventually calls LoadLibrary) from DllMain (which is what calls InitInstance) is a Bad Thing. And I’m fairly sure that OpenGL context creation uses LoadLibrary at some point to load the ICD OpenGL .dll file.
Thanks for the response. I had a feeling that this was not really a great idea, but couldn’t find anything definitive. I was stumped about why so many calls succeeded, like the window creation, but then binding the framebuffer that had just been created would fail. And not even fail, but hang forever. Maybe I should just take that as a sign to initialize OGL elsewhere. It does seem to work when I don’t use the FBO, but I’m sure it’s still not a good practice.