wglChoosePixelFormatARB returns 0

When we first create our window, it's in windowed mode, and we choose and set a pixel format for the window. Then we choose a pixel format for a pbuffer, and create the pbuffer. This works.

The user can then "go fullscreen" which means that we call ChangeDisplaySettings(), and then call wglChoosePixelFormatARB() again to determine pbuffer support. We pass it the DC from the original window (which we retain -- we cannot re-create the context because there are other embedded windows in the same window that we don't control).

At this point, or any point thereafter, wglChoosePixelFormatARB() returns 0 formats, and a return code of 0. Any attempt to create a pbuffer fails, returning a NULL pbuffer DC.

This is on Radeon 9700 Pro / Windows XP SP1, although it happens on other cards, too.

My theory is that the driver thinks that, because I've set a pixel format on the DC, I can't choose one from that point on. However, that doesn't seem right, because you can't create a pbuffer until you have a pixel format, so choosing pixel formats must be possible even after setting them (even though you can only set pixel format once on a given DC).

"If you can't afford to do something right,
you'd better make sure you can afford to do it wrong!"