I'm working on an Android app using Open GL ES 2.0. I'm confused about memory management in Open GL.
My questions are:
- How much memory is available to the Open GL hardware? Clearly it's going to vary from device to device.
- How can I find out how much memory is in use and how much is left?
- What happens if I exceed the memory limits?
- What techniques should I be using to unload data not currently being displayed?
I presume I'm going to have to implement some kind of system to unload textures that are not currently in use on an LRU basis, but I'd like some idea of what criteria to use for this. The app silently dies at some point and I suspect it is because I'm using too much graphics memory.
Currently I'm never unloading textures and I seem to be able to load quite a few - testing on a Nexus 7 I have been able to load 134 1024x1024 RGBA textures, which I calculate to be over 500MB. I presume once the textures have been loaded into graphics memory they take up less space, but that's still a lot, and clearly I have to manage that but I'd like some tips on how to start.