Scene graph is not properly updated for rendering

Hello



I have a Window class that creates a Camera and their own ViewPorts. It has 2 ViewPorts. One of the viewPorts is for the guiNode (also a Node from this Window class). This guiNode has bitmapText attached to it. The guiNode.updateLogicalState(tpf) and guiNode.updateGeometricState() are the only ones in the Window’s update() method. When using this class and calling the update, i receive errors that says


SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalStateException: Scene graph is not properly updated for rendering.
Make sure scene graph state was not changed after
rootNode.updateGeometricState() call.
Problem spatial name: BitmapFont
at com.jme3.scene.Spatial.checkCulling(Spatial.java:227)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:466)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:462)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:655)
at com.jme3.renderer.RenderManager.render(RenderManager.java:687)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:216)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:141)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)
at java.lang.Thread.run(Thread.java:662)
Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion `map->l_init_called' failed!
Java Result: 127


Please help me how to solve these errors.

here is the code for the Window class
[java]public Window(Node rootNode, Node speedroid,
int width, int height, int splits, float[] portBounds,
Application app) {

this.app = app;
this.speedroid = speedroid;
this.width = width;
this.height = height;

setCamera(splits, portBounds);
setViewPort(rootNode);
setChaseCam();

guiNode.setQueueBucket(Bucket.Gui);
guiNode.setCullHint(CullHint.Never);
initBitmapText();

setGuiViewPort();
}

private void setCamera(int splits, float[] portBounds) {
cam = new Camera(width, height);
cam.setFrustumPerspective(45, (float)(width/splits)/height, 1, 1000);
cam.setViewPort(portBounds[0], portBounds[1], portBounds[2], portBounds[3]);
cam.setLocation(speedroid.getLocalTranslation().clone().addLocal(0, 0, 1));
cam.lookAt(speedroid.getLocalTranslation(), Vector3f.UNIT_Y);
}

private void setViewPort(Node rootNode) {
viewPort = app.getRenderManager().createMainView("Player Viewport", cam);
viewPort.setClearEnabled(true);
viewPort.attachScene(rootNode);
}

private void setChaseCam() {
chaseCam = new ChaseCamera(cam, speedroid);
chaseCam.setSmoothMotion(true);
chaseCam.setDefaultDistance(30.0f);
chaseCam.setMinDistance(28.0f);
chaseCam.setMaxDistance(40.0f);
chaseCam.setTrailingSensitivity(1);
}

private void setGuiViewPort() {
Camera guiCam = cam.clone();
guiViewPort = app.getRenderManager().createPostView("Player GUI ViewPort", guiCam);
guiViewPort.setClearEnabled(false);
guiViewPort.attachScene(guiNode);
}

private void initBitmapText() {
BitmapFont font = app.getAssetManager().loadFont("Interface/Fonts/Oloron/Oloron.fnt");
text = new BitmapText(font, false);
text.setColor(ColorRGBA.White);
text.setSize(font.getCharSet().getRenderedSize());
text.setText("Player Lap");
text.setLocalTranslation(130, 200, 0);
guiNode.attachChild(text);
}

public void update(float tpf) {
guiNode.updateLogicalState(tpf);
guiNode.updateGeometricState();
}[/java]

Commenting the guiNode.attachChild(text); makes the errors dont show...

heres how I use this Window class on a simpleApp
[java]
//on simpleInitApp
window = new Window(rootNode, character, width, height, 1, new float[]{0,1,0,1}, this);

//on simpleUpdate
window.update(tpf);
[/java]

THANK YOU SO MUCH

Where are you acquiring the guiNode? If you get it from SimpleApplication, then you don’t need to update it since the app takes care of that for you

the guiNode is created inside the Window class…

Hope I can use this thread since I have the same problem “Scene graph is not properly updated for rendering”).

Sometimes my app work, sometimes I get this error. This happen, because I use a external thread to load the scene.

That helps me to start the app faster and gives me a nice performance boost. I would like to keep the thread!



Is there any way to prevent this error? Is it not possible to catch this error when it occurs, meaning, that if it occurs I do the root.updateGeometricState()?

Although you can load a model on another thread you have to attach it on the OpenGL thread:

[snippet id=“10”]

ok, my Window class now works by making its guiViewPort a “Main View”. Question, what is the difference between the renderManager.createmainView() , renderManager. createPreView() and renderManager.createPostView()… is it just the layering of views or it determines which is going to be rendered(?) / processed first ?



thank you :slight_smile:

If I use



[java]Future fut = application.enqueue(new Callable() {

public Object call() throws Exception {

//this is where you modify your object, you can return a result value

return modifyObject();

}

});



//to retrieve return value (waits for call to finish, fire&forget otherwise):

fut.get();[/java]



the thread does not finish. I do not really understand, how to use this method in my application.

Hope you can give an other example, please!

If you use this method on the OpenGL thread, dont use the get() method. This waits for the task to finish and since the OpenGL thread is supposed to execute it if you wait for that on the OpenGL thread it is blocked, you created a deadlock.

Ok, that explain it.

What method should I use instead?

Well if you are on the OpenGL thread theres no use in using a callable, except you want the command to be executed later. In that case you simply dont need to get() the return value and just let the callable be executed later.

Hi!



I know it’s an old thread, but I wanted to say thank you.

It also works for me :smiley:



Thanks!!