Wgl problems

I’ve got a desktop color depth of 16bpp, and the app is asking SDL for a
32 bpp framebuffer. My hardware has no accelerated mode for that, so
ChoosePixelFormat gives me an unaccelerated compat mode. This caused
strange problems[1].

One possible solution: ignore the bpp settings when in a window, and
always use the desktop color depth. (The SDL app can’t do this–there’s
no way to find out the desktop color depth–and it probably shouldn’t have,
as this is a Windows-specific problem.) However, I can get a 16bpp
window when my screen is 32bpp, which is useful, so it’d be annoying for
this to be forced all the time.

Perhaps, if ChoosePixelFormat returns an unaccelerated mode, we should
try again with the desktop bit depth (if it’s different), and if that
try gives an accelerated mode, use it instead. That’s tricky, though;
ChoosePixelFormat, contrary to the documentation, seems to only be able
to choose modes based on cRedBits/cGreenBits/cBlueBits, and ignores
cColorBits, so we’d have to figure out reasonable values for those. I’m
not sure how to do that, other than to just hardcode values for each
color depth (and possibly the presence of alpha or not).

Ideas? Lacking a solid solution that might be applied to CVS, I’ll
just throw together a replacement ChoosePixelFormat that igonres
unaccelerated modes, but that’s probably not appropriate for a general
fix unless another call is added to toggle it.

[1] It wasn’t unaccelerated; rather, some calls seemed to only support
OpenGL 1.1 functionality (eg. that of the default ogl driver); in
particular, packed pixel modes to glTexImage2D returned GL_INVALID_ENUM–but
it was still claiming OpenGL 1.4. I removed nvogl32.dll, ran it again, and
it correctly dropped completely to the fallback driver; put it back, and
then it correctly dropped completely to that driver when in the compatibility
mode. I can’t reproduce that bizarre half-and-half behavior anymore, though
it might come back if I reboot. It’s probably avoided completely by forcing
acceleration, though.–
Glenn Maynard