Problem: 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/ commit 7fd5f76e1eb4bbf93fe9b1171744bd755d8f96e4, not complete yet.
Bug 665 (part 3) - Add EGL/ES2 tests, attempt to fix wrapped EGL case - Add EGL/ES2 tests in - TestGLContextDrawableSwitch01NEWT - TestGLContextDrawableSwitch11NEWT - 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. Discussion: 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 4: http://jogamp.org/git/?p=jogl.git;a=commit;h=c225285e09f0a29fca418601bf1aa07cafb54339 Part 5: http://jogamp.org/git/?p=jogl.git;a=commit;h=e2506d7663b752f00f0a98f793ebad52e65bd1e3
Part 6 http://jogamp.org/git/?p=jogl.git;a=commit;h=3ad03e41a0cda81119c23f350c00b064a4de70c2 Part 7 (Android Specific) http://jogamp.org/git/?p=jogl.git;a=commit;h=d514ecbf052d013ea8c0982c490757678075a9ea 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.