Desktop vs OpenGL resolution

hello,

Can I run my OpenGL window in a different resolution than my Windows desktop?

If my Windows desktop is set to 1680x1050, can I run my OpenGL game on the screen at 800x600, but still cover the whole screen?

I’m looking for high frame-rates for users with slow PCs.

Thanks.

Before creating the window and rendering context do:


// Get the current settings to query the frequency.

DEVMODE mode;
mode.dmSize        = sizeof(DEVMODE);
mode.dmDriverExtra = 0;

EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &mode);

// Change to new mode.

mode.dmPelsWidth  = 800; // New width.
mode.dmPelsHeight = 600; // New height.
mode.dmBitsPerPel = 32;
mode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;

ChangeDisplaySettings(&mode, CDS_FULLSCREEN);


ChangeDisplaySettings returns DISP_CHANGE_SUCCESSFUL if all went well.

To go back to desktop resolution:


ChangeDisplaySettings(0, 0);

Have fun.

That works great, EvilOne! You’re not so evil.

Thanks for the quick reply and super code.

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