GLSurfaceView is a set of helper code that simplifies the use of OpenGL ES with SurfaceView. You are not required to use it to use GLES, and if you have tons of other things going at the same time, I recommend that you do not.
If you compare Grafika's β show + capture camera β complexity, which uses GLSurfaceView, β continuous capture β, which uses the usual SurfaceView, you can see that the latter requires a bunch of extra code to control the EGL and rendering stream, but it also there are fewer hoops, he does not need to deal with GLSurfaceView EGL and flow control. (Just read the comments at the top of the CameraCaptureActivity class.)
As one commenter noted, I suspect that there is no βon destroyedβ callback because the class aggressively destroys its EGL context, so there is no need to clear GLES. Of course, it would be useful if the renderer thread had the ability to clear resources other than GLES, but that is not the case, so you should handle this through the Activity lifecycle callbacks. (At some point in the development, CameraCaptureActivity processed the camera on a rendering stream, but the lack of a reliable shutdown callback made it difficult.)
The cleanup code should probably be based on activity lifecycle callbacks. Note that they are partially separate from SurfaceView callbacks. A full explanation can be found in the doc application for architecture .
source share