simpleRender() is called every frame just like simpleUpdate().
Oh, OK so create the objects on other method and update on the SimpleRender right?
@pspeed I tried to set up everything and update the node on a different, but It’s still crashing.
public void CreateSeparate() {
view = new Node();
Viewcam = Main.app.getCamera().clone();
Viewcam.setViewPort(0, 1, 0, 1);
viewPort = Main.app.getRenderManager().createMainView("Top Left", Viewcam);
viewPort.setClearFlags(true, true, true);
viewPort.attachScene(view);
System.out.println("ViewModels Things Set Up!");
}
public void Updating() {
view.updateGeometricState();
view.updateModelBound();
view.updateLogicalState(0.1f);
System.out.println("Updating ♻︎");
}
public void CreateModels() {
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White);
view.addLight(ambient);
Spatial teapot = Main.app.getAssetManager().loadModel("Models/Teapot/Teapot.obj");
Material defaultMat = new Material( Main.app.getAssetManager(), "Common/MatDefs/Misc/ShowNormals.j3md");
teapot.setLocalTranslation(0, 0, 10);
teapot.scale(10);
teapot.setMaterial(defaultMat);
view.attachChild(teapot);
System.out.println("❒❒❂ Spatials Created");
}
Run order::
public static void simpleInitApp() {
...
CreateSeparateReality();
CreateModels;
}
public simpleRender() {
...
Update();
}
Crash Message
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalStateException: Scene graph is not properly updated for rendering.
State was changed after rootNode.updateGeometricState() call.
Make sure you do not modify the scene from another thread!
Problem spatial name: null
at com.jme3.scene.Spatial.checkCulling(Spatial.java:260)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:647)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:640)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:974)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:744)
This is exactly backwards. Err… sorry, in the spirit of .net style method names… This Is Exactly Backwards.
You Always Update Logical State First And You Should Use The Tpf Passed To Update And Not A Constant Value. The Entire Thing At Issue Has Always Been UpdateGeometricState From The Very Beginning. THAT Is The One You Should Do On Render.
You really like this joke , do you?
me?
nope pspeed
this thread is starting to become a chatroom
the application keeps crashing, Surprisingly the only time it doesn’t crash is when I create and update everything in the simpleRender Method, this is what I mean:
public void simpleRender() { //This doesn't crash 4 some reason.
view = new Node();
Viewcam = Main.app.getCamera().clone();
Viewcam.setViewPort(0, 1, 0, 1);
viewPort = Main.app.getRenderManager().createMainView("Top Left", Viewcam);
viewPort.setClearFlags(true, true, true);
viewPort.attachScene(view);
view.updateGeometricState();
}
This Crashes with the same crash message (NO UPDATE ON THREAD…):
public void initApp() {
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White);
view.addLight(ambient);
Spatial teapot = Main.app.getAssetManager().loadModel("Models/Teapot/Teapot.obj");
Material defaultMat = new Material( Main.app.getAssetManager(), "Common/MatDefs/Misc/ShowNormals.j3md");
teapot.setLocalTranslation(0, 0, 10);
teapot.scale(10);
teapot.setMaterial(defaultMat);
view.attachChild(teapot);
view = new Node();
Viewcam = Main.app.getCamera().clone();
Viewcam.setViewPort(0, 1, 0, 1);
viewPort = Main.app.getRenderManager().createMainView("Top Left", Viewcam);
viewPort.setClearFlags(true, true, true);
viewPort.attachScene(view);
}
public void initRender() {
view.updateGeometricState
}
Me:
Do I have to create a separate render thread or something?
Yes sorry I troll from time to time
Guys, I’m turning 21 next year. I just looked back and this thread. Sorry For Being Cringe.
Don’t be! You picked a very ambitious way to learn at a fairly young age, and naturally that involves asking a lot of questions that might feel a bit “cringe” later (the same thing still happens when you’re a senior engineer and learning a new product/project in the enterprise world). Kudos to you for working that hard to learn something - hopefully it was a valuable experience for you, and I hope we’ll see more of you (& your current projects!) on the forum!