Jump to content
  • Advertisement

Archived

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

Shadow1234567890

Full screen doesn't return to system resolution

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

I am trying to make a window run in fullscreen. It basically works except when you quit the program it leaves windows resolution in the opengl window resoution. The opengl program is set to run in 1024 * 768, and windows is set to run higher than that. Here is my fullscreen code, which I am surprised actually does anything.
	if (MessageBox(NULL,"Run in rullscreen?","SEETEE GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) {
	
	//fullscreen stuff needs to be done before the window is created otherwise weird things can happen!!!!
	DEVMODE devModeScreen;
	memset(&devModeScreen, 0, sizeof(devModeScreen));
	devModeScreen.dmSize = sizeof(devModeScreen);
	devModeScreen.dmPelsWidth = 1024;	//You are supposed to use the same width and height in the DEVMODE
	devModeScreen.dmPelsHeight = 768;	//datastructure as when you actually create the window
	devModeScreen.dmBitsPerPel = 16;	//This should probably be the same...currently my system is running in 16bbp
										//so it seemed like a good idea to use 16

	devModeScreen.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;

	if(ChangeDisplaySettings(&devModeScreen, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
		fullScreen = false;

	DWORD dwExStyle;
	DWORD dwStyle;

  // if we''re still in fullscreen mode, set the window style appropriately
	if (fullScreen)
	{
		dwExStyle = WS_EX_APPWINDOW;
		dwStyle = WS_POPUP | WS_BORDER | WS_MAXIMIZE;			// simple window with no borders or title bar
		ShowCursor(FALSE);            // hide the cursor for now
	}
	else
	{
		dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
		dwStyle = WS_OVERLAPPEDWINDOW;
	}
}
 
Any other criticism is welcome, because I am still trying to figure out what I''m doing here.

Share this post


Link to post
Share on other sites
Advertisement
I would recommend retrieving the current system resolution when the program starts and explicitly setting it back after you release the OpenGL context. That may be the only way to guarantee consistent behavior across any video device or Windows version.

[edited by - Waverider on August 14, 2002 1:30:01 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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!