Archived

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

chasin

Change screensize (fullscreen)

Recommended Posts

chasin    122
Hi, i need to change the size of the screen when it''s fullscreen to 640x480 and not leave the value to the computer default size. how can i do it using GLUT? thanks!!!

Share this post


Link to post
Share on other sites
Ruudje    100
Well I (and appearantly more people) don''t know how using glut, but I can tell you how using win32. You didn''t write what os you''re using, but I have a feeling it''s linux?

Share this post


Link to post
Share on other sites
Ruudje    100
well this is a very basic function to do it (it lacks error-handling, but it wasnt needed in this program anyway)


/*

Function: SetRes()

Alters the desktop resolution to width*height,
The mode will automatically restore once the program shuts down

*/
void __fastcall TMainform::SetRes(int width, int height)
{
DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory''s Cleared

dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = 32; // Selected Bits Per Pixel

dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
}

Share this post


Link to post
Share on other sites