Skybox in standardgame (jme2)

Hi,

I create a skybox initially in my game(it loads just fine) but then later on when I try to switch to a different skybox (when traveling to a different area) the game just freezes …

Here is the area where it freezes at:

Future<Object> future = GameTaskQueueManager.getManager().update(new Callable<Object>() {
            public Object call() throws Exception {
                sky.preloadTextures();
                sky.lockBounds();
                sky.lockMeshes();
                return null;
            }
        });
        try {
            future.get();
        } catch (Exception ex) {
            ex.printStackTrace();
        }


thanks

Hi,

That's because you call GameTaskQueueManager and .get() from the jme thread. In each jme thread, a part of code deals with code inserted into the GameTaskQueueManager. .get() blocks the thread and waits for the response. But the thread can never reach the point where GameTaskQueueManager is processed.



If this code is always called in the jme thread then you don't need GameTaskQueueManager. If the code can be called in any thread then it's a bit more tricky.

Thank you,  ;)

I used this instead and it worked:

class LockTask implements Callable {
            public Object call() throws Exception {
                sky.preloadTextures();
                sky.lockBounds();
                sky.lockMeshes();
                return null;
            }
        }
        LockTask task = new LockTask();
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).enqueue(task);