How does JME use LWJGL?

Hi!

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(GLContext.java:124)
	at org.lwjgl.opengl.GL11.glViewport(GL11.java:3261)
	at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glViewport(LwjglGL20.java:839)

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. (http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=4802&p=22988&hilit=restart+jvm#p22988) 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…

Yes.
And see here: jmonkeyengine/LwjglContext.java 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.