0
\$\begingroup\$

Say I have a skybox and the user can choose out of 2 sets of 6 textures (one for each face of the cube) to use on that skybox. For example if user selects set A, I load the textures (GLES20.glGenTextures etc) and put them on the cube.

However, if the user then selects set B, should I delete the textures I previously created? Or what's the standard way of dealing with textures that are (at least temporarily) no longer needed? Also, is texture deletion an expensive operation?

My app will include other scenarios similar to the above, so I might end up having 10-15 (or more) textures in memory with only a few of them displayed, therefore I expect deleting them is the way to go.

\$\endgroup\$
0
\$\begingroup\$

I know that in AndEngine (which is also for Android) that you can load/unload resources like textures whener you want.

When you're in this kind of situation be sure to unload ALL textures you don't need or aren't using because this would otherwise take up a lot of memory (if you're doing this with multiple textures).

If you're making a mobile game be sure that you always only load what you need and unload what you don't. It might take some practice to get it right. A game I made had a Resource manager where we could load the resources per scene of the game. That might be a good solution for you too.

I hope this helps you out.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.