JME Canvas embedded in Swing crashes on Linux

Hi, me again and my Swing issues :frowning_face:

I successfully have my application running in a Swing window, no issues on Windows. But running on Linux causes some renderer exceptions when the app state is started:

A popup:

Failed to initialize OpenGL context
LWJGLException: Could not find GLX 1.3 config from peer info

And a stack trace:

org.lwjgl.LWJGLException: Could not find GLX 1.3 config from peer info
	at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method)
	at org.lwjgl.opengl.LinuxPbufferPeerInfo.<init>(
	at org.lwjgl.opengl.LinuxDisplay.createPbuffer(
	at org.lwjgl.opengl.Pbuffer.createPbuffer(
	at org.lwjgl.opengl.Pbuffer.<init>(
	at org.lwjgl.opengl.Pbuffer.<init>(
	at org.lwjgl.opengl.Pbuffer.<init>(
	at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(
	at com.jme3.system.lwjgl.LwjglCanvas.createContext(
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(
	at java.base/

Native method… oof. So here’s that method, which leads me here. I then see:
NULL is returned if an undefined GLX attribute is encountered in attrib_list, if screen is invalid, or if dpy does not support the GLX extension.
Debugging C is not high on my skillset… although I may not be the only one with this issue.

None of this appears when running in a regular AWT window. Any apparent solutions?

What version of jme3 are you using, & also the Linux distro & version ?

Edit : it may be a well-known issue for GPU drivers for this particular Linux distro version, since GPU drivers are written in c represented as shared libraries that may cause invalid gl context if they are not there so 2 options :

  1. check GPU drivers for your particular systems
  2. search driver update for your particular system
  3. try another distro live boot

JME 3.4.0, Ubuntu 20.04. I can provide my glxinfo if it helps.

I’ll also try fiddling with GPU drivers later today.

I’ve been fiddling with this for a while now and I can’t find anything that works. For now I’m just adding an option in my application to use the standard display engine.

lwjgl3 or lwjgl2?

I’m assuming lwjgl3, I haven’t changed it.

lwjgl3 is known not to work with AWT on some platforms. It may not be the specific cause of your issue but it will definitely be an issue.

My own reliance on Swing/AWT is one of the things that keeps me on lwjgl2.


Wait… I missed that the first time. You should on some level know what dependencies your project has, no?

I think it would be safe to assume that the latest version of JME would also use an updated version of its underlying graphics library. It wasn’t exactly critical to the development of the rest of my program to know this.

I’m trying appSettings.setRenderer(AppSettings.LWJGL_OPENGL2) with the same results. Or am I doing this wrong?

OpenGL and LWJGL are 2 different things.

In JME, the LWJGL version is determined by which library your classpath contains: jme3-lwjgl (for v2) or jme-lwjgl3 (for v3).

Oh… sorry. Here’s my Gradle dependency: implementation "org.jmonkeyengine:jme3-lwjgl:3.4.0-stable" so I’m assuming this means I’ve been on LWJGL v2 already?

1 Like