Suppose I create a window with an opengl rendering context in the usual way that you can find in almost every win32 opengl tutorial: create window, choose pixel format, set pixel format, create opengl rendering context, make it current. Suppose I now make a call to the win32 function ChangeDisplaySettings and change my display settings to something with say, a different color depth than before. Will the opengl graphics still display properly?
The reason I ask this question is because I did a small test where I enumerated the pixel formats of a single device context under two different display settings, and discovered that both the total count and types of pixel formats were different. This seems to indicate that pixel formats are dependent on display settings, and a questionable potential situation arises: it may be that I’ve set the pixel format of a device context to be a pixel format which, under different display settings, is no longer enumerated as a valid pixel format of that device context. Sounds like a bad situation.
After reading discussions on similar topics it seems the common answer is that win32 may “mess up things” when passing through some types of display changes. A common solution I see used is to simply destroy the entire window and recreate it whenever display settings change. However, through much reading of the win32 documentation, I haven’t found anything that discusses this issue at all, so I’m somewhat skeptical of “things might get messed up”. From my own (very simple) tests it appears to work fine, but of course this isn’t at all an indicator of behaviour across multiple systems.
Any help with this would be greatly appreciated.