How To Get A Surfaceholder With A Valid Surface (needed By Egl.eglcreatewindowsurface)?
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 Sur
Solution 1:
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
.
Solution 2:
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.
Post a Comment for "How To Get A Surfaceholder With A Valid Surface (needed By Egl.eglcreatewindowsurface)?"