Loading resources in separate thread

Hi everyone,

I just started with jme and wrote a small app that runs fine. Next I’d like to have a typical loading screen that displays the percentage of the loaded resources. So I put the loading procedure into a separate thread. But now I get an ArrayOutOfBounds exception (I also tried this with pure lwjgl and found out that every texture I create via glGenTextures returns the id=0).

I read in a different post that all OpenGL calls have to be in the same thread. Since rendering and creating of textures are both OpenGL calls, meaning that I can’t separate them, how do you implement a typical loading screen?

Any help is appreciated

P.S: jME is great work! I really like it :slight_smile:

Load it from disk to some kind of buffer in separate thread. Opengl thread could spin repainting loading screen, waiting for ready buffer. When it is ready, bind texture in main thread (it should take small amount of time compared to fetching data from disk) and wait for next texture, with opengl displaying larger percent of loaded data.

It is an OpenGL issue.