jmonkeyengine: v3.6 crashes attempting to run example apps in fullscreen with LWJGL v2

Investigating a possible regression in JME v3.6.0-alpha1, I tried to run some of the apps in jme3-examples in fullscreen mode … for example jme3test.helloworld.HelloJME3 (though I ran into identical behavior with other example apps). Here’s what happens:

  • The display settings dialog appears with “Fullscreen” not checked and “Refresh Rate” blank.
  • I check the box for “Fullscreen”.
  • The “Screen Resolution” changes to1920x1080 and the “Refresh Rate” changes to 55 Hz. Unfortunately, 55 Hz isn’t a valid refresh rate for my display adapter. I believe the valid rates are 24, 30, and 60 Hz.
  • When I try to select a different refresh rate, there are only 6 available options: 50 Hz, 51 Hz, 52 Hz, 53 Hz, 54 Hz, and 55 Hz. None of these are valid rates.
  • After I click the “Continue” button, I get two “Error in Application” dialogs and the app crashes.

The console output is:

Jan 03, 2023 10:59:04 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-alpha1
 * Branch: master
 * Git Hash: 5b9fc87
 * Build Date: 2023-01-03
Jan 03, 2023 10:59:05 AM com.jme3.app.LegacyApplication handleError
SEVERE: Failed to create display
java.lang.RuntimeException: Unable to find fullscreen display mode matching settings
	at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:80)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:120)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
	at java.base/java.lang.Thread.run(Thread.java:833)

Jan 03, 2023 10:59:05 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.IllegalMonitorStateException: current thread is not owner
	at java.base/java.lang.Object.notifyAll(Native Method)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:135)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
	at java.base/java.lang.Thread.run(Thread.java:833)


Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread "jME3 Main"

Excerpt from glxinfo (to document my graphics configuration):

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 545/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 390.157
OpenGL core profile shading language version string: 4.60 NVIDIA

This was with “jme3-lwjgl” (LWJGL v2, which is currently the default jme3-examples build). Here’s what happened when I switched the build to use “jme3-lwjgl3” (LWJGL v3):

  • The display settings dialog appears with “Fullscreen” not checked and “Refresh Rate” blank.
  • I check the box for “Fullscreen”.
  • The “Screen Resolution” changes to1920x1080 and the “Refresh Rate” changes to 55 Hz.
  • When I try to select a different refresh rate, there are only 6 available options: 50 Hz, 51 Hz, 52 Hz, 53 Hz, 54 Hz, and 55 Hz.
  • After I click the “Continue” button, the application runs fullscreen.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 31 (31 by maintainers)

Commits related to this issue

Most upvoted comments

Yet another solution is to do something like riccardobl did with JmeDialogsFactory and JmeDialogsFactoryImpl.

I would be okay with that.

we might get from one hole to another!

Based on my experience, if org.lwjgl.opengl.Display.getAvailableDisplayModes() puts us in a hole, it will be a much shallower hole than the one AWT has put us in.

LWJGL and AWT do not play nicely together.

LWJGL v3 loads its natives using a static initializer, so there’s no need for us to explicitly load them. I suspect the test app fails with LWJGL v3 because GLFW.glfwInit() isn’t invoked prior to DsUtils.listDisplayModes().

Both LWJGLv2 and LWJGLv3 provide methods to enumerate the available display modes. For my Acorus library, I wrote utility methods to dynamically determine which version(s) of LWJGL are available and invoke the appropriate method. It seems to work reliably.

I think we should do something similar for the v3.6 display-settings dialog.

sgold:~$ xrandr -q
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
DVI-I-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-I-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 853mm x 480mm
   1920x1080     60.00*+  59.94    29.97    23.98    60.05    60.00  
   1680x1050     59.95  
   1440x900      59.89  
   1440x480      60.05  
   1280x1024     60.02  
   1280x960      60.00  
   1280x800      74.93    59.81  
   1280x768      59.99  
   1280x720      60.00    59.94  
   1024x768      60.00  
   800x600       60.32    56.25  
   720x480       59.94  
   640x480       59.94    59.93  
sgold:~$ 

ertugrulcetin’s solution doesn’t work for me.

1280x960 screen resolution does work for me.

I think we can close this as a duplicate of #947.