Hi,
Here’s a description of a bug i had the occasion to see quite often in my short (~3years) opengl programming experience.
It results in the opengl application to crash in the best case, blue screen in the worst case, even under windows2000 and XP.
To experience it, it’s extremely simple, just launch a first application using opengl, and a second one in fullscreen for example. when you exit the second application, the first one crashes, or the whole system crashes.
After further exploration of the issue i realised the problem is due to the fact the second application may use the command:
wglMakeCurrent(NULL,NULL);
in its deinitialisation. when the first application tries to send opengl commands again, no context is bound, which results in instability.
The only solution i know to the problem so far is to use a:
wglMakeCurrent(myHDC,myHRC);
in the rendering loop. However, the issue is that this command isn’t free in execution time.
To solve this kind of issue in a general way, 2 new functions would be necessary, something like:
wglPushContext();
wglPopContext();
assuming opengl32.dll would implement a context stack inside the library. It would enable the application to save the context possibly previously used and to restore it cleanly.
comments/ideas/whatever welcome