PDA

View Full Version : OpenGL & Windows Resolution



JackBoot
12-06-2000, 10:37 AM
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!

Thanks!
-Mark

Glossifah
12-06-2000, 10:55 AM
You need to retrieve the desktop settings?

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

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
devMode.dmBitsPerPel

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?

Glossifah