LWJGL3 startup crash

When running jME 3.1.0-beta3 with LWJGL3 (gradle artifact: ‘org.jmonkeyengine:jme3-lwjgl3:3.1.0-beta3’), I get a crash when starting with all default settings, but only if the settings are NOT loaded from a file. When my application starts, it looks in the user’s home directory for its settings directory. If it does not find it, it creates the default jME settings like so:

private static AppSettings defaultSettings(){
     AppSettings settings = new AppSettings(true);
     try {
	settings.save(System.out);
     } catch (IOException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
     }
		
     settings.putString("uistyle", "glass");
		
     return settings;
}

… and then it displays the jME settings window:

if(!Files.exists(settingsFile)){
   settings = defaultSettings();
   app.setShowSettings(true);
   ... save settings and here and continue with startup
}
   

Here are the settings that are dumped to System.out when only default settings are used (only clicked ‘Continue’ on the jME settings window)

#jME3 AppSettings
#Sun Jan 29 11:42:29 PST 2017
Renderer(string)=LWJGL-OpenGL2
Width(int)=640
DisableJoysticks(bool)=true
SettingsDialogImage(string)=/com/jme3/app/Monkey.png
Height(int)=480
Title(string)=jMonkeyEngine 3.1-beta3
Samples(int)=0
Resizable(bool)=false
BitsPerPixel(int)=24
UseInput(bool)=true
GammaCorrection(bool)=false
Frequency(int)=60
DepthBits(int)=24
Fullscreen(bool)=false
AudioRenderer(string)=LWJGL
StencilBits(int)=0
VSync(bool)=false
FrameRate(int)=-1
MinHeight(int)=0
MinWidth(int)=0
SwapBuffers(bool)=true

Here are the settings that are loaded from the file:

#jME3 AppSettings
#Sun Jan 29 11:42:56 PST 2017
Renderer(string)=LWJGL-OpenGL2
Width(int)=640
DisableJoysticks(bool)=true
SettingsDialogImage(string)=/com/jme3/app/Monkey.png
Height(int)=480
Title(string)=jMonkeyEngine 3.1-beta3
Samples(int)=0
Resizable(bool)=false
BitsPerPixel(int)=24
UseInput(bool)=true
GammaCorrection(bool)=false
Frequency(int)=60
DepthBits(int)=24
Fullscreen(bool)=false
AudioRenderer(string)=LWJGL
StencilBits(int)=0
VSync(bool)=false
FrameRate(int)=-1
MinHeight(int)=0
MinWidth(int)=0
SwapBuffers(bool)=true
uistyle(string)=glass

Both sets of settings are identical with the exception of the uistyle line, which is only because the uistyle is added after the newly created default settings are dumped to System.out. In short: both sets of settings are identical. However, if my application starts with the settings that are created on the fly (not loaded from file), my application crashes with the following:

(java:9812): Gtk-WARNING **: Unable to locate theme engine in module_path: "oxygen-gtk",
Jan 29, 2017 11:42:35 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.1-beta3
 * Branch: HEAD
 * Git Hash: 69cd160
 * Build Date: 2017-01-29
Jan 29, 2017 11:42:35 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.0.0b SNAPSHOT context running on thread main
 * Graphics Adapter: GLFW 3.2.0 X11 GLX clock_gettime /dev/js XI Xf86vm shared
X Error of failed request:  RenderBadPicture (invalid Picture parameter)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  7 (RenderFreePicture)
  Picture id in failed request: 0x3e00021
  Serial number of failed request:  803
  Current serial number in output stream:  813

This only happens with LWJGL3 - if I run against LWJGL2 it all starts up fine whether the settings are freshly created or loaded from file.

Thought I’d bring this up for whoever is working on LWJGL3 integration. :slight_smile:

You shouldn’t use AWT dialog before creating lwjgl3 context.

Yes as @javasabr said, not show the settings dialog, it cause crash with GLFW window.

Hm, interesting. In my case it really doesn’t matter. My application runs fine with LWJGL2, and I have no requirements for one or the other. I noticed this a few months back and only now took the time to thoroughly investigate the cause of the crash.

I didn’t realize that this was a known problem, so with the announcement of the 3.1.0-beta3 release I wanted to make sure it was known in case it’s significant enough for a jME dev to want to tackle before a 3.1.0 final release.

LWJGL2 uses AWT backend, LWJGL3 uses GLFW backend, it makes a lot of differences between these versions.

This seems like an unfortunate “bug” in LWJGL 3. There are many apps that may open an AWT panel for a splash or for logging in before running, etc…

Do they consider this a bug or is it just “the way it’s going to be”? Kind of makes lwjgl3 unusable in some cases.

If you create a lwjgl3 context in background, after this you can show awt panel.

So lwjgl3 doesn’t consider this a bug? Or there is no way for them to fix it?

Seems bad to me.

I didn’t deep research this issue because it isn’t an issue for me :frowning: but I think it’s an issue of GLFW.

The LWJGL3 stance is that AWT/Swing is not officially supported. Because of that, they will not fix this bug.

Wow, that’s quite a limiting move for a lot of people.

Instead you can use JavaFX for your splash screen.
It may be better to upgrade JME’s settings window to JavaFX in jme 3.2. (if it is considered to get released with LWJGL3 and Java 8)

For my use it makes no difference it all. Right now I’m using LWJGL2, and the jme initial settings window is sufficient for the time being. If I ever made my own settings window I’m sure I would use JavaFX - it’s an absolutely amazing toolkit.

LWJGL2 has terrible supporting inputs on linux :slight_smile:

Wuh oh, that’s definitely a problem for me. Trouble in what way?

for example russian hotkeys don’t work on lwjgl2

Wow, that’s too bad. That definitely complicates internationalizing a project. I take it from what @Ali_Rs was saying that LWJGL3 plays nicely with JavaFX?