I try to initialize GLES with EGL (because I want to draw from the main thread instead of using a Renderer and drawing from inside onDrawFrame). I get the error: \"Make sure the
Implement SurfaceHolder.Callback, and wait until you're told that the surface has been created. Also pay attention to when it is destroyed. You should only rely on the surface being valid between matching create and destroy calls.
The check valid for surface
should be did when surface is created. So, surface.isValid()
should be called in onSurfaceCreated
or onSurfaceChanged
, obviously, you should add surfaceholder.callback
.