wglChoosePixelFormatARB returns 0

We use pbuffers for offscreen rendering at times.

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).


We also need to go fullscreen with pbuffers.

It looks like it does not append on nvidia cards but it fails on my Radeon 9600.

I isolated the problem in a minimal application with glut :
http://thomasbesson.free.fr/wglChoosePixelFormatARB.cpp <a href=“http://thomasbesson.free.fr/wglChoosePixelFormatARB.zip” target=“_blank”>
http://thomasbesson.free.fr/wglChoosePixelFormatARB.zip</a> (vc6 src + bin)
You will have to change display resolution manually to make it append.

Did you solve the problem ? found a workaround ?
Please keep me in touch if you found anything


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.