My game has an in-game settings dialog. Most of it’s settings relate to things that can be easily changed in-game (ie. adding-removing spatials and filters). One that I just tried to add, however, is nonfunctional. Specifically, I attempted to add a vsync setting so that the user can decide if they want to enable it or not.
Here is my code that updates the vsync value in JME. It is in my SettingsAppState that stores the settings data but doesn’t change it (there is a separate SettingsGuiAppState for that). This code is called when the user exits the settings dialog (the vsync variable is updated by said dialog):
AppSettings settings = getApplication().getSettings();
if(settings.isVSync() != vsync){
System.out.println("Setting vsync to: " + vsync);
settings.setVSync(vsync);
getApplication().restart();
}
When I run this code the println outputs as expected, but, there is no change in the framerate which leads me to believe that vsync was not applied (simply setting it to false from the start yeilds significantly higher framerates). Additionally, after a few seconds the following crash occurs:
Apr 24, 2016 1:13:09 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,6,main]
java.lang.IllegalArgumentException: This NativeObject is not registered in this NativeObjectManager
at com.jme3.util.NativeObjectManager.deleteNativeObject(NativeObjectManager.java:136)
at com.jme3.util.NativeObjectManager.deleteUnused(NativeObjectManager.java:188)
at com.jme3.renderer.opengl.GLRenderer.postFrame(GLRenderer.java:870)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:189)
at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:229)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Thread.java:745)
I should also note that this is taking place in a swing panel with 3.1 alpha.