”Restart” a SimpleApplication?


I am currently working on an application that might use 3D rendering, and I encountered a problem.

When I don’t need 3D anymore, I must stop the render thread. No problem with this, I call the SimpleApplication “stop(true)” method, and the thread disappears of the threads list when I am in debug mode.

But when I am trying to recreate a SimpleApplication object, I get this :

org.lwjgl.opengl.OpenGLException: Invalid value (1281)

at org.lwjgl.opengl.Util.checkGLError(Util.java:59)

[catch] at com.jme3.system.lwjgl.LwjglOffscreenBuffer.checkGLError(LwjglOffscreenBuffer.java:101)

at com.jme3.system.lwjgl.LwjglOffscreenBuffer.runLoop(LwjglOffscreenBuffer.java:124)

at com.jme3.system.lwjgl.LwjglOffscreenBuffer.run(LwjglOffscreenBuffer.java:147)

at java.lang.Thread.run(Thread.java:722)

Am I stopping the application the wrong way, or is it just impossible to do this ?

Thanks in advance,


When you call stop() the OpenGL context is being closed. Your options are to either pause (which will stop rendering, keeping the scene) or to use stop the scene and re-instantiate again when you need it. Which one fits your situation best, only you will know :slight_smile:

Well, calling stop() and re-instantiating the app is already what I do…

I use SceneProcessors, can it be a bad cleaning of the resources in the processors that causes this ?

Oh I see… I thought you were re-calling start(). The SceneProcessors should be tidily cleaned on stop(). @nehon or @Momoko_Fan?

Do you have the error if the sceneProcessor is not added to the viewPOrT?

Yes, I still get the error even if I don’t add them to the viewport.