when an android app is stopped by being put on the background when tapping the "home" button, the WindowDriver.surfaceDestroyed method is called and ultimately the GLContext is destroyed.
When the app comes back to life (and the activity.onResume is called), the GLWindow becomes visible again, but with a blank gl context that lost all VBO and textures.
It would be great to save the GL context when the surface is destroyed and restored when a new surface gets attached to the gl window.
Will refine the whole GLContext.setDrawable(..), i.e. GLContext<->GLDrawable
association to allow an unbound GLContext. The latter is ofc to be treated very carefully,
i.e. no method shall be called until re-associated w/ GLDrawable.
Then .. when passing unit tests etc., we can have an option in e.g. NewtBaseActivity to flag
GLContext survival ..
part 1 - see commit message ..
Achieved: New test case w/ GLContext surviving GLAutoDrawable destruction
and re-association (X11, Windows and OSX w/ NEWT).
Tackling EGL derived surface case w/
not complete yet.
Bug 665 (part 3) - Add EGL/ES2 tests, attempt to fix wrapped EGL case
- Add EGL/ES2 tests in
- Attempt to fix wrapped EGL case (incomplete)
- Using EGL/ES w/ non native EGL device/surface, but natively wrapped instances (most of the cases),
a 'complicated' delegation of
Native-Upstream -> EGL-Proxy -> EGL-Instance
is being used heavily relying on the objects lifecycle.
GLEventListenerState tries to roll back the realized state
and even sets the upstream device handle,
but this doesn't seem to be sufficient on X11.
It might turn out that we only can implement the survival of GLContext
and it's display device reliable w/ EGL within the GLAutoDrawable implementation,
which can hold the previous not destructed instances.
Part 7 (Android Specific)
Tested manually on Android devices, i.e. when pressing HOME
and returning to application, the state has been preserved (no dispose/init on GLEventListeners
and same GLContext is being used .. etc). This is visible when the 'gears' for example
return in the same [rotational] state when left ..
GLEventListenerState handling is described w/ interface GLStateKeeper
to be used and queried by any platform if desired.