I add InputListeners, Mappings and Triggers and they work as expected. Within my Netbeans program I have the possibility to switch between multiple scenes. There is one Application object but if I switch between two scenes I must remove all nodes, InputListeners, Triggers and Mappings, Audio etc. When I perform such a switch (or only deactive one scene and activate it again) the InputListeners do not react anymore. My questions are as following…
Do I have to take care for the sequence I add InputListeners, Mappings and Triggers?
Do I have to take care for the sequence I remove InputListeners, Mappings and Triggers?
Do I have to reinit something after adding and/or removing?
Everything is performed in the RenderQueue of course.
Thanks a lot for help.
Yep, you probably change the scenegraph from the AWT Event Dispatch Thread (the main AWT thread). You have to wrap everything in callables or use an AppState or something as callback from the OpenGL thread like I do in jMP to modify scene data.
Normally not, if you just add and remove them when appropriate it should work, I guess its something in your code. jMP adds and removes input listeners each time a different plugin (e.g. SceneComposer, TerrainEditor) takes over the scene.
I have figured out the problem. It is again (my long term friend)…
Update exception. Scene graph is not properly updated for rendering.
Make sure scene graph state was not changed after
Problem spatial name: CrystalScene 671862692487168
I suppose, that I have to call
after adding the scene tree to the root node again, but I thought this is done automatically within the render loop.
It is done automatically as part of the render loop.
The cases where you run into this:
- you are modifying the scene graph outside of the update loop (ie: from another thread)
- you are modifying the scene graph in some control’s or app state’s render call.
- the root node you are using is not the same one that your Application is calling updateGeometricState() on… ie: you’ve setup your own viewport with its own root node or something.
when exactly do I have to use AppStates and what are they used for. What is the difference to the enqueue method of Application?