[SOLVED] Manually updating a new rootNode - Scene graph is not properly updated for rendering

Hi.

Is there anything beyond having

actorNode.updateLogicalState(tpf);
actorNode.updateGeometricState();

inside simpleupdate required when manually updating a node? I have a seperate Camera and Viewport as per the “render to texture” demo

    ViewPort offView;
    Texture2D offTex;
    Camera offCamera;

And I make the actorNode the rootNode for the new viewport

offView.attachScene(actorNode);

But I am getting the “Scene graph is not properly updated for rendering” error. (Problem spatial name: null :frowning: )

Before I go mad tearing bits apart, do I need to update anything else? In particular I was wondering if I have to update the new camera, and also by updating my “actorNode” I assume all its children get updated too right?

When I attach actorNode to the root I get no error, but updating actorNode seperatly when not attached does not work. Just wanted to check with you guys I am doing this right before I start commenting everything out - I realise I will otherwise have to comb my code looking for answers.

Is it possible that you’re modifying actorNode after calling updateGeometricState on it?

1 Like

Oh shit I bet I am

Yep, dammit…

Thank you :slight_smile:

Do that on your app state’s update().

Do that on your app state’s render().

And if you’re not using an app state to manage the special node… then shame on you. :slight_smile:

If you could see my code :wink: Shame doesn’t quite cover it

3 Likes

3.1 has a “RootNodeAppState” which is properly updated fwiw

It does updateGeometricState() in the update() call instead of in render(). In my experience, certain combinations of use can cause the state to be dirtied after the update call. For example, all of the other app states registered after that one are running their updates which may change things about the scene in a fairly logical way.

Also, the regular root node and gui node are updated after all of the app states have been updated… and after simpleUpdate().

So any cross-referencing between viewport scenes (say to sync a map indicator with a spatial’s position) can modify some scene after the app state has updated it.

I’ve found that following an “only update the scene during updates” policy and then putting my updateGeometricState() in AppState.render() solves all of these issues.

Probably RootNodeAppState needs to be fixed, I guess. Put this discussion out here in case someone sees a flaw in my logic.

1 Like