How to get a SurfaceHolder with a valid Surface (needed by EGL.eglCreateWindowSurface)?

前端 未结 2 1249
悲&欢浪女
悲&欢浪女 2021-02-15 06:37

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

2条回答
  •  無奈伤痛
    2021-02-15 07:08

    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.

提交回复
热议问题