-1

when an android app is in the background the android os can clear its resources if its low on memory.

in my case its the glcontext and gl resources that are getting lost and crash the app.

in order to not restart the app entirely i would like to identify that this event had happened and recreate Open GL related resources.

i couldnt reproduce it / force this to happen.

my questions are:

does checking if eglGetCurrentContext() == EGL_NO_CONTEXT is enough to know that the context was lost? or there is an other way of knowing it?

is there any way to reproduce this issue?

specs

the app logic is in c++ using SDL2 framework.

the gl contexts get created by SDL_GL_CreateContext(window).

i can make jani calls to java if needed.

dvrer
  • 589
  • 6
  • 17

1 Answers1

1

On your activity onResume() you will need to call eglMakeCurrent() to make your context the current context. If the context as been freed then that will set the EGL error state to EGL_CONTEXT_LOST.

solidpixel
  • 10,688
  • 1
  • 20
  • 33