I’m creating an OpenGL-based 2D game. I want to create a loading screen to load my assets. I want to draw something to show the user that something is loading. But I learned that I can’t use a separate thread like asynctask to load my textures. So I’m stuck there. How can I create a loading screen to load my assets?
Share
Depends what you mean by “load”. The loading is a two-step process:
The texture creation a la
glTexImage2dcan slow things down a bit temporarily in terms of FPS, but this isn’t a problem normally, especially when you’re showing a (static) loading screen.So in principle you could do all of the loading on the GL thread, if your splash screen is static (i.e. nothing moves and hence FPS doesn’t matter):
If your splash screen is dynamic however, you will want to do 3. on a separate loading thread, and once that is done, create the game textures on the GL thread. This requires signalling from the loading thread to the GL thread that the loading of the assets is ready for texture creation.