0
\$\begingroup\$

After onPause is called for the GLSurfaceView the rendering surface is destroyed, along with all the textures, shaders and the like. On onResume() should the surface not be recreated and GLRenderer onSurfaceCreated called? However that is never called. I am using render when dirty.

\$\endgroup\$
2
  • \$\begingroup\$ Are you calling GLSurfaceView.onResume() from the application's onResume()? \$\endgroup\$ Commented Dec 7, 2011 at 13:48
  • \$\begingroup\$ Yes, I am calling onResume() and onPause() \$\endgroup\$
    – leonmajere
    Commented Dec 7, 2011 at 18:31

2 Answers 2

1
\$\begingroup\$

If you use this modified version of GLSurfaceView your rendering surface will not be destroyed:

http://replicaisland.googlecode.com/svn/trunk/src/com/replica/replicaisland/GLSurfaceView.java

As far as graphical context (OpengGL ES context) is concerned there is a myth surrounding this issue, that it's destroyed when onPause is called. No that is quite not true. Your context stays alive as long as there is still memory left for other contexts to be called upon.

For example if you have 3 games each requiring around 100 MB of RAM, they can all run at once on a Samsung Galaxy S2, which has around 800+ MB, depending on the manufacturing model. However on low memory devices you should implement a texture + shader load/unload method.

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

I believe this is something the android framework does, as some devices / GPU's can't support multiple GL states and clearing any onPause() allows other apps to use openGL.

I just accept that and reload textures etc onResume(). If you keep your textures as bitmaps in memory as well as all your vertices etc, you should be able to minimise the amount of time it takes to reload after resumption.

Then again, I don't extend GLSurfaceView and do all my rendering in GLSurfaceView.Renderer

EDIT: Actually, check the answers for this question

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .