问题描述
我正在用 And 引擎开发一个抛出异常的游戏.其实我不知道异常发生的点.市场上多次报道.
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??
推荐答案
如果您没有将 Activity 的状态转换通知 GLSurfaceView,则可能会发生此错误.请参阅此处的以下段落:http://developer.android.com/reference/android/opengl/GLSurfaceView.html
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
活动生命周期
必须在活动暂停时通知 GLSurfaceView 并且恢复了.GLSurfaceView 客户端需要调用 onPause() 当当活动恢复时,活动暂停并 onResume().这些电话允许 GLSurfaceView 暂停和恢复渲染线程,以及允许 GLSurfaceView 释放并重新创建 OpenGL 显示.
A GLSurfaceView must be notified when the activity is paused and resumed. GLSurfaceView clients are required to call onPause() when the activity pauses and onResume() when the activity resumes. These calls allow GLSurfaceView to pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate the OpenGL display.
我不知道 andengine 如何处理这个.
I don't know how andengine handles this though.
这篇关于eglSwapBuffers 失败:EGL_BAD_ALLOC AndEngine Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!