Proper way to load resources

Is there a proper way to load resources in a Standard Game?

I have a number of gatestates, and one of them loads the resources I'll use before hand. but Since noticing it wasn't loaded within the OpenGL thread, I'm sure the game still has to load the resource anyway. If I'm reading from an XML file which textures / models to load on startup, how am I supposed to load a resource in a way that I can use it later on?


Future<Object> future = GameTaskQueueManager.getManager().update(new Callable<Object>() {
   public Object call() throws Exception {
       return createObjectHere();
   }
});
future.get();



future.get() will block the current thread until the OpenGL thread has returned.

Just change the Generic parameter Object to whatever you are returning (Node, Spatial, Geometry, ...) and you should be good to go.

Excellent. I shall pass this on to the monkeys to get to work again.

If I understand correctly, you want to preload your resources from an XML file so that later on during the game you don't have to load them? For textures it's quite easy, you just call TextureManager.preloadTextures() after loading all the textures using TextureManager.loadTexture(). Models, shaders, and possibly other resources are not cached, which means you have to do the caching part yourself for those.

TextureManager.preloadCache( Renderer );

preloadTextures() doesn't seem to exist on the TextureManager class