Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


changing screen/colour resolution

This topic is 5691 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using openGL, I find the best resoultion to use is 800x600 with 16 bit colours. The problem is that I don''t know how to change the screen/colour resolution from within a C++ or Win32 program. At the moment all I can do is ''measure'' the width of the screen using GetSystemMetrics(...) and displaying a MessageBox("For best results change resolution to 800x600") This is especially important because, for instance, if someone has set their colours to 256 colours or their screen size to 1024x.... their computers might not handle it and the program will look rubbish or even crash. Is it because I use Borland C++ 4.50 which maybe is too old nowadays? (OK, so the link between this question and openGL is at best tenuous.)

Share this post

Link to post
Share on other sites

#include <windows.h>

// You'll need this on some compilers:


#define CDS_FULLSCREEN 0x4


void SetFullscreenMode(bool fullscreen,int w,int h,int bpp,int refresh)
DEVMODE devmode;
devmode.dmSize = sizeof(devmode);
devmode.dmBitsPerPel = bpp;
devmode.dmPelsWidth = w;
devmode.dmPelsHeight = h;



Should do it. However, in some cases you can't change the bpp of the screen and you do actually have to use the desktop bpp.

[edited by - JuNC on March 24, 2003 12:19:10 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!