0

I m developing a live wallpaper with opengl es 2.0 and i would like to know if there is a way to keep the textures loaded on create of renderer ,or the bitmaps , so they dont need to recreate every time screen orientation changes , or when screen goes off. i have done this with buffers (indices etc) but textures , and bitmaps are recycling.

tshepang
  • 12,111
  • 21
  • 91
  • 136

1 Answers1

0

The behavior you are experiencing is part of the standard lifecycle behavior of an OpenGL application in Android.

It is very well explained in this Google I/O video at 30:29

http://developer.android.com/videos/index.html#v=5yorhsSPFG4

Anyway, the fact that he memory in the GPU needs to be re-initialized, does not mean that you need to reload from scratch.

You can achieve pretty good performances by doing the following:

  1. Load everything in memory at start-up (VBOs + Textures + Indices + etc)

  2. Load in GPU memory and bind every time you get back the context from allocated system memory(Point 1) to GPU

In this way you take 2 birds with a stone, you can guarantee that your resources are constantly well usable and you do not burden the load time every time the "back in context" occurs.

Maurizio Benedetti
  • 3,557
  • 19
  • 26
  • Thank you for your reply , i thought that my problem is what you describe. Can you please tell me when you say to load textures to memory so i can use them every time i get back context, how you mean to do it? objects that are recycling are not only the opengl textures , but bitmaps too, so what to load from a png file for example? thanks – George Dimopoulos Jun 01 '12 at 16:03