使用GLSurfaceView.onPause()时出错

时间:2013-01-14 02:22:32

标签: android andengine glsurfaceview

我正在使用AndEngine开发Android游戏,我在logCat中遇到以下错误:

01-13 20:44:46.726: D/AndEngine(16843): StartActivity.onPause @(Thread: 'main')
01-13 20:44:46.726: I/GLThread(16843): onPause tid=17
01-13 20:44:46.726: I/Main thread(16843): onPause waiting for mPaused.
01-13 20:44:46.734: I/GLThread(16843): mPaused is now true tid=17
01-13 20:44:46.734: I/GLThread(16843): releasing EGL surface because paused tid=17
01-13 20:44:46.734: W/EglHelper(16843): destroySurface()  tid=17
01-13 20:44:46.734: D/BRCM_EGL(16843): eglMakeCurrent(NULL) Thread: 16858
01-13 20:44:46.734: D/BRCM_EGL(16843): eglDestroySurface() surface: 0x219018, android          window 0x2187f8, Thread: 16858
01-13 20:44:46.734: W/EglHelper(16843): finish() tid=17
01-13 20:44:46.734: D/BRCM_EGL(16843): eglDestroyContext() context: 0x266ec8, VC  context: 1, Thread 16858
01-13 20:44:46.734: E/EGL_SERVER(16843): pid mem_get_free_space before =  5ffb80
01-13 20:44:46.734: E/EGL_SERVER(16843): pid mem_get_free_space =  5ffb80
01-13 20:44:46.750: I/GLThread(16843): releasing EGL context because paused tid=17
01-13 20:44:46.750: D/AndEngine(16843): StartActivity.onPauseGame @(Thread: 'main')
01-13 20:44:46.859: I/GLThread(16843): noticed surfaceView surface lost tid=17
01-13 20:44:48.843: D/AndEngine(16843): StartActivity.onResume @(Thread: 'main')
01-13 20:44:48.843: I/GLThread(16843): onResume tid=17
01-13 20:44:48.843: I/Main thread(16843): onResume waiting for !mPaused.
01-13 20:44:48.843: I/GLThread(16843): mPaused is now false tid=17
01-13 20:44:48.851: I/GLThread(16843): noticed surfaceView surface acquired tid=17
01-13 20:44:48.851: W/EglHelper(16843): start() tid=17
01-13 20:44:48.859: D/BRCM_EGL(16843): eglCreateContext() context: 0x266ec8, VC context    1, Thread 16858
01-13 20:44:48.859: W/EglHelper(16843): createContext  com.google.android.gles_jni.EGLContextImpl@40521008 tid=17
01-13 20:44:48.859: W/GLThread(16843): egl createSurface
01-13 20:44:48.859: W/EglHelper(16843): createSurface()  tid=17
01-13 20:44:48.859: D/BRCM_EGL(16843): eglCreateWindowSurface() surface: 0x219018, VC surface: 1, Thread: 16858
01-13 20:44:48.859: D/BRCM_EGL(16843): eglMakeCurrent(0x266ec8, 0x219018, 0x219018) Thread: 16858
01-13 20:44:48.859: I/Main thread(16843): onWindowResize waiting for render complete from tid=17
01-13 20:44:48.867: W/GLThread(16843): onSurfaceCreated
01-13 20:44:48.867: D/AndEngine(16843): VERSION: OpenGL ES 2.0
01-13 20:44:48.867: D/AndEngine(16843): RENDERER: VideoCore IV HW
01-13 20:44:48.867: D/AndEngine(16843): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5,   Alpha=0, Depth=0, Stencil=0)
01-13 20:44:48.867: D/AndEngine(16843): EXTENSIONS: GL_OES_compressed_ETC1_RGB8_texture  GL_OES_compressed_paletted_texture GL_OES_texture_npot GL_OES_depth24   GL_OES_vertex_half_float GL_OES_EGL_image GL_EXT_discard_framebuffer GL_OES_rgb8_rgba8 GL_OES_depth32
01-13 20:44:48.867: D/AndEngine(16843): MAX_VERTEX_ATTRIBS: 8
01-13 20:44:48.867: D/AndEngine(16843): MAX_VERTEX_UNIFORM_VECTORS: 128
01-13 20:44:48.867: D/AndEngine(16843): MAX_FRAGMENT_UNIFORM_VECTORS: 128
01-13 20:44:48.867: D/AndEngine(16843): MAX_TEXTURE_IMAGE_UNITS: 8
01-13 20:44:48.867: D/AndEngine(16843): MAX_TEXTURE_SIZE: 2048
01-13 20:44:48.867: D/AndEngine(16843): StartActivity.onSurfaceCreated @(Thread:    'GLThread 17')
01-13 20:44:48.867: D/AndEngine(16843): StartActivity.onReloadResources @(Thread: 'GLThread 17')
01-13 20:44:48.867: D/AndEngine(16843): StartActivity.onResumeGame @(Thread: 'GLThread 17')
01-13 20:44:48.867: W/GLThread(16843): onSurfaceChanged(480, 320)
01-13 20:44:48.867: D/AndEngine(16843): StartActivity.onSurfaceChanged(Width=480,  Height=320) @(Thread: 'GLThread 17')
01-13 20:44:49.085: E/(16843): RTOS COMMON MEM zero linear buffer allocated 1949696 0 205
01-13 20:44:49.085: E/(16843): BIG MEM OUT OF HANDLES
01-13 20:44:49.132: D/dalvikvm(16843): GC_EXTERNAL_ALLOC freed 42K, 51% free  3021K/6087K, external 696K/1208K, paused 47ms
01-13 20:44:49.289: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.289: E/(16843): RTOS COMMON MEM zero linear buffer allocated 4771840 0 205
01-13 20:44:49.289: E/(16843): BIG MEM OUT OF HANDLES
01-13 20:44:49.539: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.593: E/(16843): RTOS COMMON MEM zero linear buffer allocated 360448 0 205
01-13 20:44:49.593: E/(16843): BIG MEM OUT OF HANDLES
01-13 20:44:49.640: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.679: D/dalvikvm(16843): GC_EXPLICIT freed 260K, 51% free 3020K/6087K, external 696K/1208K, paused 42ms
01-13 20:44:49.710: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.710: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.710: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.710: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.710: E/(16843): Unable to Find Phys Addr for 225a98
01-13 20:44:49.718: E/BRCM_EGL(16843): eglSwapBuffers Error 0x505
01-13 20:44:49.726: W/EglHelper(16843): destroySurface()  tid=17
01-13 20:44:49.726: D/BRCM_EGL(16843): eglMakeCurrent(NULL) Thread: 16858
01-13 20:44:49.726: D/BRCM_EGL(16843): eglDestroySurface() surface: 0x219018, android window 0x2187f8, Thread: 16858
01-13 20:44:49.726: W/EglHelper(16843): finish() tid=17
01-13 20:44:49.726: D/BRCM_EGL(16843): eglDestroyContext() context: 0x266ec8, VC  context: 1, Thread 16858
01-13 20:44:49.734: E/EGL_SERVER(16843): pid mem_get_free_space before =  5ffb80
01-13 20:44:49.734: E/EGL_SERVER(16843): pid mem_get_free_space =  5ffb80
01-13 20:44:49.750: W/dalvikvm(16843): threadid=12: thread exiting with uncaught exception (group=0x4001c578)
01-13 20:44:49.804: E/AndroidRuntime(16843): FATAL EXCEPTION: GLThread 17
01-13 20:44:49.804: E/AndroidRuntime(16843): java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
01-13 20:44:49.804: E/AndroidRuntime(16843):    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1085)
01-13 20:44:49.804: E/AndroidRuntime(16843):    at   android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1043)
01-13 20:44:49.804: E/AndroidRuntime(16843):    at   android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1369)
01-13 20:44:49.804: E/AndroidRuntime(16843):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)
01-13 20:44:49.835: D/AndEngine(16843): StartActivity.onPause @(Thread: 'main')
01-13 20:44:49.835: I/GLThread(16843): onPause tid=17
01-13 20:44:49.835: D/AndEngine(16843): StartActivity.onPauseGame @(Thread: 'main')
01-13 20:44:57.968: D/AndEngine(16843): StartActivity.onDestroy @(Thread: 'main')
01-13 20:44:57.968: D/AndEngine(16843): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
01-13 20:44:57.968: D/AndEngine(16843): org.andengine.engine.Engine$EngineDestroyedException
01-13 20:44:57.968: D/AndEngine(16843):     at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:574)
01-13 20:44:57.968: D/AndEngine(16843):     at org.andengine.engine.Engine.onTickUpdate(Engine.java:560)
01-13 20:44:57.968: D/AndEngine(16843):     at org.andengine.engine.Engine$UpdateThread.run(Engine.java:820)
01-13 20:44:57.968: D/AndEngine(16843): StartActivity.onDestroyResources @(Thread: 'main')
01-13 20:44:57.968: D/AndEngine(16843): StartActivity.onGameDestroyed @(Thread: 'main')

游戏在很多设备上运行良好,但在三星Galaxy Ace(GT-S5830C)上因此错误而崩溃。它发生在我关闭/重新打开游戏几次,或者几次切换游戏活动之后。

实际上,如果我在游戏退出时终止进程,则在加载/重新加载游戏时不会发生此问题。如果我在暂停活动时不调用GLSurfaceView.onPause(),则切换活动时也不会发生这种情况。两者都不是好的做法,但为我们提供了一些关于这个问题的线索,因为两者似乎都避免了可能是根本原因的资产重新加载。我错过了什么吗?

这可能是与设备相关的问题吗?这种解决方法的副作用是什么?

0 个答案:

没有答案