How long does openGL keep texture?
Does texture memory remain after exiting it?
For example, if I have the following code:
mGL.glGenTextures(1, mTextures, 0); mGL.glBindTexture(GL10.GL_TEXTURE_2D, mTextures[0]);
What changes will invalidate the return value?
I donβt want to reload all my textures when I return to activity (say, a person had a phone call) because it really slows down.
Update:
Found this information in the Renderer documentation, which confirms the answer below: @svdree:
EGL Context There are situations when the EGL rendering context is lost. This usually happens when the device wakes up after sleep. When the EGL context is lost, all OpenGL resources (such as textures) that are associated with this context will be automatically deleted. For the rendering to display correctly, the visualizer must recreate any lost resources that it still needs. The onSurfaceCreated method (GL10, EGLConfig) is a convenient place to do this.
This means that the textures are associated with the EGL context.
After posting this question, I tried to solve the problem by following my steps based on a basic action that has a link to a custom GLRenderer. Basically, I can pass OpenGLSurface View forward (i.e., make it an instance in one action and use it in the next), but as soon as it completes its shutdown procedure, it will not start again.
I also found that the transparency of your activity keeps the openGL context below the transparent activity (which makes sense, but only helps for menus, etc.). However, I believe that it would always be possible to perform every action after the openGL activity was a bit transparent, thereby keeping the textures in the background in all your actions (this is probably what I will do)