• Advertisement

Archived

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

Change screensize (fullscreen)

This topic is 5256 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

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
Advertisement
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
Guest Anonymous Poster
windows hehe
i think glut very easy to code

Share this post


Link to post
Share on other sites
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

  • Advertisement