Skip to content Skip to sidebar Skip to footer

Eglswapbuffers Failed: Egl_bad_alloc Andengine Android

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.Run

Solution 1:

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

Activity Life-cycle

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.

I don't know how andengine handles this though.

Solution 2:

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 by eglSwapBuffers() instead of EGL_BAD_CURRENT_SURFACE. If your code handles re-creating the surface, it should be trivial to handle this obscure case as well.

Post a Comment for "Eglswapbuffers Failed: Egl_bad_alloc Andengine Android"