Fullscreen mode crashes at start with exception

Hi,

when I use app seettings from the code, the game crashes with “Unable to find fullscreen display mode matching settings”

My main():
[java]
public static void main(String[] args)
{
AppSettings setting = new AppSettings(true);
setting.setHeight(900);
setting.setWidth(1400);
setting.setSamples(8);
setting.setFullscreen(true);
setting.setFrequency(72);
setting.setBitsPerPixel(24);
setting.setVSync(false);
Game app = new Game();
app.setShowSettings(false);
app.setSettings(setting);
app.start();
}
[/java]

72 is a strange value, but the only one the settings dialog offers besides 51(!). These are exactly the visible settings I can use from the settings-dialog without a crash. (and other combinations I’ve tried fail too)

GFX: NVidia GT 610
OS: Linux 64bit (Mint/DE Cinnamon)

The frequency is not the problem I think, but the resolution of 1400x900, which seems to be not supported.
You have to change your width and height to a size your screen is capable of.

Um, no. That is my standard (native) screen resolution. And as said, the exact same values work from the settings dialog.

I noticed that all unsupported resolutions will display refresh rates that are unsupported by my monitor. Select one that is showing the proper refresh rate and all should work fine. Not sure how/why/when this changed, but the dialog no longer populates full screen resolutions properly.

Thx, but how can my native display resolution that runs the desktop environment and ANY other fullscreen game not be supported? Especially, since it works from the settings dialog (dialog works/code doesn’t), as said twice. (I tried different resolutions/frequencies, too. Also doesn’t work)

Resolution is 1440x900, of course, but correcting that does also change nothing.

@mipesom said: Thx, but how can my native display resolution that runs the desktop environment and ANY other fullscreen game not be supported? Especially, since it works from the settings dialog (dialog works/code doesn't), as said twice. (I tried different resolutions/frequencies, too. Also doesn't work)

I don’t think 24bit color depth is supported via OpenGL at fullscreen. I think you get the option of 16 or 32 only.

So change

[java]
setBitsPerPixel(24);
// to
setBitsPerPixel(32);
[/java]

And all should be good.

Tried that, didn’t work. 24 is the only available in settings dialog too. (And i won’t write this time again that these settings work when used from the dialog… :wink: )

But your will to help is very much appreciated!!!

@mipesom said: Tried that, didn't work. 24 is the only available in settings dialog too. (And i won't write this time again that these settings work when used from the dialog.. :wink: )

Then there is a missing setting or you are misinterpretting something. How did you determine that the settings were the same as the dialog? From the look of the dialog or from what was dumped to the log?

What happens if:
setting.setSamples(8);

…is left out?

@mipesom said: Tried that, didn't work. 24 is the only available in settings dialog too. (And i won't write this time again that these settings work when used from the dialog.. :wink: )

But your will to help is very much appreciated!!!

I hear ya on it working with the settings dialog (and have since the beginning)… unfortunately, about the only way to track down what (where) the issue is, is to pretend that this isn’t the case =) Otherwise, the only answer would be: it works and you just think it doesn’t.

What are the specs of your monitor? Max resolution, refresh rate, etc. This is were the discrepancy is. Running the dialog window, might adjust invalid settings on ‘Continue’, where as not showing the dialog window… might not. I haven’t verified this, so it is a guess… however, if one works and the other doesn’t… it is likely the case.

The other question is… does setSamples() adjust anti-aliasing? or?

Thanks, for your help, but a very strange thing happened: Over night (PC not restarted, Netbeans not restarted) it works now without ANY changes. I can’t think of a connection, but the only thing I did in between (except sleeping) was looking if my C++/Irrlicht testapp has any trouble to go fullscreen (it hadn’t, and also uses the real frequency 60).

Still, I think that there might be a hidden bug, but ATM, I’m no longer affected - hope, it stays that way.

Again, THANKS to all who tried to help! :slight_smile:

I found this solution and it worked for me on (LWJGL2) OS X - MacBook Pro;

public static void main(String[] args) {
        GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

        AppSettings setting = new AppSettings(true);
        setting.setFullscreen(true);
        setting.setFrameRate(60);
        setting.setFrequency(device.getDisplayMode().getRefreshRate());

        HelloTerrain app = new HelloTerrain();
        app.setShowSettings(false);
        app.setSettings(setting);
        app.start();
    }
1 Like