Loading Screen

Is it possible and if so, how can I, make a loading screen while my models and textures are loaded into the scene? Because as of now the screen just goes black for several seconds while it loads.

I was never able to get my loading screen to work, but i think the correct way is to use appstates.

do the model loading in another thread.

One way is to have a list of assets you want to load and then load all of them but don’t do anything with them. You can use AssetLoadListener to get an event when each asset is loaded so you can update a progress bar. You can also use renderManager.preload() to upload a scene/model to the video card without actually rendering it. This will force textures and meshes to be uploaded so that the next time that scene/model is used it should render instantly the first time.



Like tralala mentioned, use another thread to do the loading so you don’t stall the rendering thread. The AssetManager is thread-safe so it should be fine to do it that way.

2 Likes

Or if you feel that it’s kinda empty because it’s a black screen there when you’re loading up your assets, you can take a look at this page if you haven’t heard of NiftyGUI.

hello, i may implement this:

how about a swing JPanel is added as a “loading bar” when application inits,

(the jme 3d canvas is not added), and when asset loading finishes, it will remove the “loading bar” and attach the jme 3d canvas.

tralala said:
hello, i may implement this:
how about a swing JPanel is added as a "loading bar" when application inits,
(the jme 3d canvas is not added), and when asset loading finishes, it will remove the "loading bar" and attach the jme 3d canvas.

If you're making a Swing/AWT application then that's another way of doing it. However note that preloading the assets won't do anything since the context is re-created when the canvas is attached.