Tony Bogdanov
Tony Bogdanov

Reputation: 7686

Android: OpenGL: When to load textures?

I am trying to make an OpenGL game which has say 3 stages: Welcome, Battle and Armor. Each stage has different logic and works with different textures.

When is the best time to load those textures, all in the beginning, or load the ones that are used by each stage when it is activated. If so, should I then delete them when switching to another stage?

If the second method is best, how can I show static splash screen (image) while loading the textures per each stage?

Upvotes: 0

Views: 285

Answers (2)

Benlitz
Benlitz

Reputation: 2002

Well, loading texture (especially from the sd card) can take time. The reason to load them before you need them is to avoid having a loading screen between stages. If the player will often switch between stages, and your texture are not so big, you might want to load them at startup (giving the pain of waiting for the game to load only once, even if it would be longer). You have to balance your choice between the memory that is available for you, and how much you want to piss the player by interrupting him in his playing experience.

You could also distract the player by displaying a scoreboard at the end of a stage to show him how good he's just been, instead of a loading bar.

If you can anticipate when the player will soon switch to another stage, you can try to stream the texture in background a little before, but it's a lot more complicated to do (well, especially on a mobile platform), so you'd need to do some research for that.

Upvotes: 1

Akhil
Akhil

Reputation: 14038

I think you should load them only if they are needed for that stage. Why waste memory by loading textures on your Video RAM if the player may not make it to the next stage?

You can show a dialog which is custom to your needs and dismiss it when you are ready. I don't have any samples right now.

Upvotes: 0

Related Questions