Hello,
I’m having problem with inserting a geometry. Sometime it gets through other times error. The error code
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]
java.lang.IllegalStateException: Scene graph is not properly updated for rendering.
Make sure scene graph state was not changed after
rootNode.updateGeometricState() call.
What I have done is aded a new function
public class MonkeyCanvas extends SimpleApplication {
public MonkeyCanvas() {
super();
.....
}
public synchronized void addRenderQueue( final RenderQueueMain renderQueue) {
Future fut = enqueue(new Callable() {
@Override
public Object call() throws Exception {
renderQueue.doIt();
//this is where you modify your object, you can return a result value
return null;
}
});
}
}
The RenderQueueMain code is
public abstract class RenderQueueMain {
abstract public void doIt();
}
public class RenderQueueGeometryAdd extends RenderQueueMain {
private static final String ID = RenderQueueGeometryAdd.class.getName();
private MyGeometry GEOMETRY;
private Node ROOT_GEOMETRY_TO_ADD;
public RenderQueueGeometryAdd( Node RootGeometryToAdd , MyGeometry geometry ){
ROOT_GEOMETRY_TO_ADD = RootGeometryToAdd;
GEOMETRY = geometry;
}
@Override
public synchronized void doIt() {
System.out.println( ID + " geometry name = " + GEOMETRY.getName() );
ROOT_GEOMETRY_TO_ADD.attachChild(GEOMETRY);
// throw new UnsupportedOperationException("Not supported yet.");
}
}
And Somewhere is the program I have the following code to add the geometry
private void InitShapeRoot() {
MyGeometry geom;
Material mat;
Quad q;
RenderQueueGeometryAdd queue;
mat = new Material(MONKEY_CANVAS.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", MONKEY_CANVAS.getAssetManager().loadTexture("Interface/Logo/Monkey.jpg"));
q = new Quad(4, 4, false);
geom = new MyGeometry("RootShape", q);
geom.setMaterial(mat);
geom.setPickable(false);
geom.setMoveable(false);
geom.setRotateAble(false);
geom.setLocalTranslation(0f, 0f, 0f);
queue = new RenderQueueGeometryAdd(MONKEY_CANVAS.getRootNode(), geom);
MONKEY_CANVAS.addRenderQueue(queue);
}
Hope somebody can help me on this ?
God Bless
Eng Huat