Enqueue() problem


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() {

public synchronized void addRenderQueue( final RenderQueueMain renderQueue) {
Future fut = enqueue(new Callable() {
public Object call() throws Exception {

//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;
public RenderQueueGeometryAdd( Node RootGeometryToAdd , MyGeometry geometry ){
GEOMETRY = geometry;

public synchronized void doIt() {
System.out.println( ID + " geometry name = " + GEOMETRY.getName() );
// 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.setLocalTranslation(0f, 0f, 0f);

queue = new RenderQueueGeometryAdd(MONKEY_CANVAS.getRootNode(), geom);

Hope somebody can help me on this ?

God Bless
Eng Huat

You are not attaching on the update loop as you are supposed to:

[snippet id=“10”]

I have added the fut.get() that was missing. The problem still persist.

How do I attach ? Do you mean I need to return a modifyObject that must not be null ? If cannot be null then what object must be for modifyObject

I think you have it backwards or something. “modifyObject()” is where normen is telling you to put your code that modifies the scene graph. The call() method is run on the render thread which is the ONLY place you can change the scene graph.

I think in this case this is where you’d put your: ROOT_GEOMETRY_TO_ADD.attachChild(GEOMETRY);

You do not need to do fut.get() and I think in general it’s really really really dangerous to use Future when you do not understand the implications of doing so.

And in any case, it’s not what you want here since it’s for returning values from the render thread to your own thread.

Thank pspeed. You we correct about backwords or something. I have found the problem. Which method is better to do scene update.

  1. simpleUpdate()
  2. update() methods
  3. Callable

    Is there any rule on which we should used for certain operation ( ie adding geometry, picking, physics , collision etc )

Assuming you mean update() methods like on Controls (controlUpdate()) and AppStates (update())…

And IF and ONLY IF you mean a callable enqueued with the already provided Application.enqueue()…

Then you can modify the scene from any of those places without concern… they are all run from the same render thread.

First, the callables are run. Then the AppStates. Then simpleUpdate() is called and then all Controls on attached nodes have their controlUpdate() called.

So it’s up to you. But if you mean a different update() then maybe not. :wink: