OpenGL & Windows Resolution

Hi Everyone,

Is there a simple way to detect the number to colors your video driver is using. Either an OpenGL or MFC solution would be nice. I’m running into a problem where I’ve made some assumptions in my coding (that I can’t back out), that require the desktop to be running with > 256 colors. I’m developing on the Windows platform (95/98/2k) and I can’t find anything in the Visual C++ that helps. I figure you guys have already dealt with this.

Any help is appreciated!


You need to retrieve the desktop settings?

Use the EnumDisplaySettings() function. Search MSDN for two things:

You’ll need to create a struct DEVMODE as per the spec, then pass it to the EnumDisplaySettings function. This will allow you to query the current settings or the registry settings for the display. The specific setting you need is

Then, if you’re feeling frisky, you redefine that value and call ChangeDisplaySettings(), passing the new devMode values. Just be careful not to force a registry update, else the desktop won’t revert back to the original state when the app closes.

Does that help?