LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: princec on November 21, 2007, 22:38:09

Title: Fullscreen switch broken in 1.1.3
Post by: princec on November 21, 2007, 22:38:09
Since upgrading to 1.1.3 this happens now in all my games when I try and click on my "Fullscreen" button in the options screens:

Failed to set fullscreen=true due to java.lang.IllegalStateException: Only modes acquired from getAvailableDisplayModes() can be used for fullscreen display
java.lang.IllegalStateException: Only modes acquired from getAvailableDisplayModes() can be used for fullscreen display
at org.lwjgl.opengl.Display.switchDisplayMode(Display.java:300)
at org.lwjgl.opengl.Display.setFullscreen(Display.java:487)
at net.puppygames.applet.Game.initFullscreen(Game.java:1220)
at net.puppygames.applet.Game.setFullscreen(Game.java:1187)
at net.puppygames.applet.screens.OptionsScreen.onClicked(OptionsScreen.java:157)
at net.puppygames.applet.Area.tick(Area.java:434)
at net.puppygames.applet.Screen.tickEverything(Screen.java:607)
at net.puppygames.applet.Screen.tick(Screen.java:561)
at net.puppygames.applet.Screen.tickAllScreens(Screen.java:942)
at net.puppygames.applet.Game.tick(Game.java:1738)
at net.puppygames.applet.Game.run(Game.java:1385)
at net.puppygames.applet.Game.init(Game.java:667)
at net.puppygames.applet.Launcher.main(Launcher.java:64)

whereas it didn't happen before. Any reason for this change?

Cas :)
Title: Re: Fullscreen switch broken in 1.1.3
Post by: Matzon on November 21, 2007, 23:19:02
yes, we detect whether fullscreen is "allowed" by checking all of the display modes gotten from getAvailableDisplayModes with the win32 api - manually created displaymodes are not guaranteed to work with fullscreen, since these haven't been checked.
Title: Re: Fullscreen switch broken in 1.1.3
Post by: princec on November 22, 2007, 09:01:18
Well, that's the funny thing, because the displaymode is of course one of those returned from getAvailableDisplayModes.

I've worked around it by explicitly changing display mode first then calling setFullScreen(true), but the idea was to get the window to cover up all the ugly display mode resizing before doing the resize.

The old behaviour was simply to make whatever window you had cover the screen at whatever resolution it is, and this behaviour seems much more intuitive.

Cas :)
Title: Re: Fullscreen switch broken in 1.1.3
Post by: elias on November 22, 2007, 10:52:40
Being a LWJGL developer yourself you should know that a small self-contained test case is mandatory :) I don't see anything wrong with the test in Display.switchDisplayMode() so we'll need a test that uses one of the modes from getAvailableDisplayModes() and still exhibit the crash.

- elias
Title: Re: Fullscreen switch broken in 1.1.3
Post by: princec on November 26, 2007, 11:32:38
Well, it's not a crash, just an annoyance.

The correct behaviour for setFullScreen(true) when a non-standard DisplayMode is currently in operation should be to read the current real physical display mode and set that; then make the window fullscreen over it.

Cas :)