How does JME use LWJGL?


I’m trying to figure out why in libGDX (yes I know this is the JME forum), one can’t quit an Application instance, and start a new one, in the same JVM process. The error one gets is:

Exception in thread "LWJGL Application" java.lang.RuntimeException: No OpenGL context found in the current thread.
	at org.lwjgl.opengl.GLContext.getCapabilities(
	at org.lwjgl.opengl.GL11.glViewport(
	at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glViewport(

The above error is the third time I try to start an Application instance. The second time it just works, but badly.

Anyway, why I’m making this thread here is that they blame LWJGL. ( Doesn’t JME use LWJGL too? But in JME, starting several Applications after each other in the same JVM works. How come? What are they missing over at libGDX? Of course, I don’t expect you to know what they are doing wrong. What I am mostly after is: Is JME using LWJGL, and what version, and so on? Do you happen to know about this problem? Maybe you can guess what the issue is with libGDX?

By the way sorry for cheating on you with libGDX, but I’m thinking that maybe I should make a 2D game instead of 3D, and I wanted to check them out. :slight_smile:

It appears that the OpenGL context is bound to a thread and you’re trying to use it (or libGDX is) from another thread.
Source: Google “lwjgl no opengl context”

Jme can use lwjgl (2.9.7?) and lwjgl3 which has its own downsites.

Browse the Engine Sourcecode at github, there is the jme3-lwjgl Module

Yeah I tried googling but one can get this error by messing up in other ways, so it’s not very useful.

And I switch to lwjgl3 by changing my dependencies? In that case, I’m using lwjgl2. Hmm…

And see here: jmonkeyengine/ at master · jMonkeyEngine/jmonkeyengine · GitHub

The initContextFirstTime indicates a different behavior when restarting.
But no one is investigating that, you have to dig through the sourcecode on your own.