I am getting this error when I detach my game run app state :
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: renderNode
My game uses heavily the render to texture solution, and I guess this node/error has to something to do with that.
Anyway, I always thought the render cycle (appstate rendering first) should prevent this from happening…
How can I fix this problem ?
is onMouseClickUp_BtnYes an event/callback that can be triggered anytime?
This is another possibility: the event is fired when the rendering has not finished processing, and it’s still looking for the detached nodes (and maybe appstates). By setting the flag you give the control of detachment of nodes back to the main loop when you process it on the update kick.
I think you can also synchronize but flags are easier to manage in most cases
Thats is because I am using reflection, the variables off the appstate are fake even for “this”.
I wander if this is the reason, because I did some debug and found out that the node.removeFromParent is getting crazy with this and its not removing all the parents…
Yeah, most likely your viewport still exists but you’ve skipped updating the spatial that is rendered there. Note: cleanup() is called at the beginning of the next update cycle… so chances are you are doing your updateGeometricState() in a strange place.
You should have an app state that manages the offscreen viewport. It will update the node during render() and render the frame there, too. The viewport will get cleaned up and removed on cleanup(), etc…
That’s what I wanted you to paste… since I need to see where you call updateGeometricState()… which should be in that app state. So if you don’t have such an app state then you need one. It will make all of this a thousand times easier to manage.
Doing it on render() makes sure two things:
-all controls have been run, all other app states that might have modified something have also been update()ed.
-if the viewport will be rendered then geometric state will be updated