Crash on full-screen enabled

I am using Mac OS 10.11.6 and JMonkey SDK 3.2.1-stable

When I try to start my game in fullscreen without specifying a refresh rate it crashes and dumps me the log below. I assume this is because no refresh rate was specified, so when the data was sent to be saved there was a null pointer error. This is fine and dandy, I just need to figure out how I can set the refresh rate, right now users can set it but they have to click the drop down menu and click “???” which is…pretty unintuitive. I tried setting the default refresh rate with cfg.setFrequency(60); before calling app.start() but this didn’t seem to alter anything on a fresh trial.
Any thoughts?

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at com.jme3.app.SettingsDialog.verifyAndSaveCurrentSelection(SettingsDialog.java:550)
	at com.jme3.app.SettingsDialog.access$200(SettingsDialog.java:62)
	at com.jme3.app.SettingsDialog$4.actionPerformed(SettingsDialog.java:442)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(BasicRootPaneUI.java:208)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1663)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2882)
	at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:307)
	at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:250)
	at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2974)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2966)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2845)
	at java.awt.Component.processEvent(Component.java:6310)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771)
	at java.awt.Component.dispatchEventImpl(Component.java:4760)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I’m assuming you are using LWJGL2 as your backend since it is the default? OSX historically hasn’t worked well in fullscreen with LWJGL2 and commonly crashes. LWJGL3 does far better in fullscreen.

Thanks for the input, I’d still like to understand what’s going on or if the devs have this in mind at all. I assume they must if their only option for refresh rate is “???” and it works lol.

Last I checked it was an LWJGL issue and since they moved to a new version I don’t think they plan on fixing it. Minecraft recently moved to LWJGL3 to fix this problem (among others).

1 Like

LWJGL 3 isn’t problem free in Macs then out of the box. You can’t use AWT and you need couple of parameters to start the game then (-XstartOnFirstThread). That is anyway what I remember.

True, but work on LWJGL2 was discontinued what… like 2 years ago+ now? Both LWJGL2 and 3 both have some pretty serious downsides and trade offs to consider at the moment. I’ve spent a significant amount of development time working around their issues.

1 Like

I had a similar problem waaay back envolving fullscreen and refresh rates: for some reason the refresh rates options would decrease as I would rise the resolution in jME’s settings dialog (59, 57, 56, 54, 52, 51HZ etc…). To be able to run at fullscreen I had to force the refresh rate to the typical 60Hz. AFAIR the problem was that AWT refresh rate != LWJGL refresh rate, causing the crash. This was on Linux however.

Yep, there are some fixes in the LWJGL 2 master. But I’ll doubt they ever make another release. LWJGL 3 is doing great and JME has already a great support on top of it. For LWJGL 3 there is a chance that things get fixed.

1 Like

This might help: Fullscreen mode crashes at start with exception - #12 by ertugrulcetin