setFullscreen(false) weird behavior

Started by Cornix, December 16, 2013, 08:53:53

Previous topic - Next topic

Cornix

Hi there.

I am currently programming a little options menu where the user can set display size, fullscreen, etc.
When the user confirms his settings I want the game to switch to the given display mode and to enable fullscreen, or disable it, depending on the settings.

The problem arises when the game is currently in fullscreen mode and the user wants to switch to windowed mode.
In this case the screen flashes between the game display, the desktop and pure black for a couple of moments, until, finally, after about 2 seconds, everything goes fine and the game display is in windowed-mode.

This is the code I use for resizing:
if (fullscreen) {
	Display.setDisplayModeAndFullscreen(mode);
}else{
	Display.setDisplayMode(mode);
	Display.setFullscreen(false);
}


However, this is not a very nice sight to see. I know that this works better in other applications, for example, professional games.

So my question is, can I make it go smoother? Is this an issue with OpenGL-Contexts? Or with lwjgl maybe?

Thank you in advance.

Fool Running

I would try calling setFullscreen(false) before you set the new display mode. This will get out of fullscreen mode then change the window size vs. changing the fullscreen resolution and then getting out of fullscreen mode.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Cornix

Damn.
That actually worked. Why did I not think of it myself?

Well, thank you a bunch for the great help.