eglSwapBuffers 失败:EGL_BAD_ALLOC AndEngine Android
我正在 And 引擎中开发一个游戏,它会抛出异常。其实我不知道异常发生在什么地方。市场上多次有报道。
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1080)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1038)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1364)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
这个有什么解决办法吗?
I m developing a game in And engine which throws the exception. Actually I don't know the point where exceptions occurs. It is reported in market many many time.
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1080)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1038)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1364)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
is there any solution for this one??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您没有通知 GLSurfaceView 有关 Activity 的状态转换时,可能会发生此错误。
请参阅此处的以下段落: http://developer.android.com/reference/ android/opengl/GLSurfaceView.html
我不知道 andengine 如何处理这个问题。
This error can occur when you don't notify the GLSurfaceView about state transistions of your Activity.
See the following paragraph from here: http://developer.android.com/reference/android/opengl/GLSurfaceView.html
I don't know how andengine handles this though.
根据我的经验(具体针对我的 Samsung Note,到目前为止我还没有测试过其他 Android 设备),
EGL_BAD_ALLOC
将由eglSwapBuffers()
错误地生成而不是EGL_BAD_CURRENT_SURFACE
。如果您的代码处理重新创建表面,那么处理这种模糊的情况也应该很简单。In my experience (which is specific to my Samsung Note, and no other Android device I've tested so far), is that
EGL_BAD_ALLOC
will be incorrectly produced byeglSwapBuffers()
instead ofEGL_BAD_CURRENT_SURFACE
. If your code handles re-creating the surface, it should be trivial to handle this obscure case as well.