【问题标题】:Android openGL - Surface is not valid SurfaceAndroid openGL - Surface 无效 Surface
【发布时间】:2012-03-26 20:03:43
【问题描述】:

有时当我退出我的 openGL ES 1 应用程序时,以下错误消息会一直在 logcat 中发布,并且应用程序会冻结并在某些时候终止。

E/EglHelper(4284): Surface is not valid Surface(name=null, identity=-1, mNativeSurface=0) java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface
E/GLThread(4284): Couldn't create a surface 132184
W/GLThread(4284): egl createSurface
W/EglHelper(4284): createSurface()  tid=22

我的问题可能出在哪里?

【问题讨论】:

    标签: android opengl-es surfaceview


    【解决方案1】:

    如果您尚未解决此问题,您应该检查一下,将您在 Activity onPause / onDestroy 回调中所做的事情与您在 surfaceDestroyed 回调中所做的事情进行比较。如果您使用 GLSurfaceView 或标准 SurfaceView 手动控制 OpenGL,则只能保证在调用 surfaceCreated 回调时开始有效表面,并在调用 surfaceDestroyed 时结束。因此,如果在您的应用退出时发生这种情况,您应该查看是否在表面已被销毁后尝试对其进行操作。

    要考虑的另一件事是,您的 logcat 条目看起来像是在尝试调用 eglCreateWindowSurface() 时引发了异常,因此您可能想了解为什么在应用退出时尝试创建新的 OpenGL 绘图表面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 2012-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多