New RenderManager update crashes my game

Latest RenderManager.java update crashes my game at loading.



When I’m starting the game, before Nifty’s screen has even come up, I’m getting a crash that I wasn’t having before.



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: Root Node



If I revert back to previous RenderManager, I can load and do what I usually do. My guess is, Nifty’s screen coming up is breaking something… I have traced the game until it would crash and it happens in the runLoop() of LwjglAbstractDisplay.java after every initialization lines has run.



Does this mean I now I have to start my Nifty loader using Future too? Or that new update (http://code.google.com/p/jmonkeyengine/source/detail?r=6240) broke something?



As I said, reverting to 6239 fixes the issue.

erf…maybe

The changes I made was to fix a culling issue.

I’m gonna test this with nifty, but Could you give me a test case, please?



Thanks.

Found the problem.



Here’s what you need to get the crash.



Start a new mygame project.

[java]package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.system.AppSettings;

import com.jme3.system.JmeContext;

/**

  • @author MadJack

    */

    public class Main extends SimpleApplication {



    private AppSettings gameSettings;

    private static Main app;



    private Main() {}



    /**
  • main() where it all begins.

    *
  • @param args

    */

    public static void main(String[] args) {

    app = new Main();

    app.start();

    }



    @Override

    public void initialize() {

    super.initialize();

    super.setPauseOnLostFocus(false);

    RootNodeState stateGame = new RootNodeState();

    viewPort.attachScene(stateGame.getRootNode());

    }



    @Override

    public void update() {

    super.update();

    }



    /**

    *

    */

    @Override

    public void destroy(){

    super.destroy();

    }



    @Override

    public void start(){

    gameSettings = new AppSettings(true);

    gameSettings.setResolution(1280, 720);

    gameSettings.setTitle(“Something”);

    gameSettings.setUseInput(true);

    setSettings(gameSettings);

    super.start(JmeContext.Type.Display);

    }



    @Override

    public void simpleInitApp() {

    }



    }[/java]



    As soon as you try to attach the scene:

    [java] RootNodeState stateGame = new RootNodeState();

    viewPort.attachScene(stateGame.getRootNode()); // <---- this one here[/java]

    in public void initialize(), you get the crash.



    RootNodeState is mostly empty.

    [java]package mygame;



    import com.jme3.app.state.AbstractAppState;

    import com.jme3.scene.Node;



    public class RootNodeState extends AbstractAppState {



    private static final Node _gameRootNode = new Node(“Root Node”);



    public RootNodeState() {

    }





    public Node getRootNode(){

    return _gameRootNode;

    }



    @Override

    public void update(float tpf) {

    super.update(tpf);

    }

    }

    [/java]



    EDIT: The error message.


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: Root Node
at com.jme3.scene.Spatial.checkCulling(Spatial.java:227)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:455)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:655)
at com.jme3.renderer.RenderManager.render(RenderManager.java:684)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:216)
at mygame.Main.update(Main.java:36)
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)

I’m sorry to say this, but the revision just revealed an issue in your code.



You are creating your own rootNode, but never use updateGeometricState on it.



look at the updtae method of simpleApplication, it does :



rootNode.updateLogicalState(tpf);

rootNode.updateGeometricState();





You need to call those methods on your rootNode in the update method of your simple application in order to allow the scene graph to update properly.

(kinda forgot to reply…)



Yep. You’re right.



Funniest is, I’m not using that anymore. It’s some old leftover code when I was trying something. It’s been removed.