SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
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: OFFSCREENROOT
It is odd because I am attaching the scene spatial to the off screen viewport root via the rendering thread. The scene spatial works fine if I attach it to the root node of the simple application.
The off screen viewport (preView) seems to instantiate fine with Texture2Ds.
Is there something I need to do in addition when using off screen viewport instead of the simple application root, such as calling updateGeometricState?
Thanks
Penny
ps I am creating a root node and adding to the off screen viewport using…
attachScene(root);
this works fine without error.
As soon as I try to root.attachChild(node) with in the rendering thread I get the error.
I am very confident that all changes are made with in the rendering thread as it all works fine when the scene is attached to the SimpleApplication.rootNode
Normally, SimpleApplication performs the updateLogicalState() and updateGeometricState() calls on the root node. If you have your own root node, you need to be the one responsible for making those two calls against it.
I am on to the next stage. I have popped a picture on to my gui using the texture of the off screen buffer but the camera doesn’t seem to be able to focus the scene. The following image is of my gui that has a background colour of yellow with a 50x50 picture textured with the frame buffer output colour texture.
There should be sky, sun, mountains and water etc.
I am sure it is something simple that I am unaware of so your help will be most grateful.
My project runs without errors and below is some excerpts of what I believe to be the crucial code.
the scene size is 100x100 and the camera is in the middle about 20m above. When the exact same scene is rendered to the main buffer is renders fine.
the size of the textures is 900x650 - thats the size I decided that would be the default size, designed for when running from a website page.
The scene is pretty much one of the test examples showing water, with sky, mountains and sun. Works fine when rendered to the main view.
The settings for the camera are exactly how I set it for the main view. I am not sure how it is zoomed in on this projection or differs from the main view.
The pictures added to the default gui using pretty much the standard objects…
Ok, I have removed the scene to only show the background colour…
I have seen this type of artefact when I didnt map my textures correctly.
I am sure the picture is displaying the texture correctly. The depth texture does not display this issue so I am happy that the issue it is not in the displaying for the textures.
I thought it might be the camera viewport not being set so I have added…
camera.setViewPort(0,0,w,h);
but it had no affect.
I have eliminated camera position and scene from the issue.
I implemented an extension of Picture which has convenience routines to display images which work fine but since I have been investigating off screen rendering I have recently been passing the textures instead of images and my code wasnt handling the sizes and scale correctly. Hence the result which I was familiar with as before.
Sorry to waste your time but it was very helpful to me and I found the cause of the issue