簡體   English   中英

在GLSurfaceView上調用onResume時GLThread無法啟動

[英]GLThread not starting when calling onResume on GLSurfaceView

我正在用OpenGLES 1.1(使用Android靜態API(GLES11))編寫游戲,並且每次我的游戲活動回到后台(按Home鍵)時,它都會返回黑屏。

我知道紋理和資源已經丟失,但是主要問題是GLThread不再運行(游戲邏輯基於GLThread運行)

我從logcat得到的錯誤是:

E/GLSurfaceView(2604): eglCreateWindowSurface
E/GLSurfaceView(2604): java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface
E/GLSurfaceView(2604):  at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native Method)
E/GLSurfaceView(2604):  at com.google.android.gles_jni.EGLImpl.eglCreateWindowSurface(EGLImpl.java:92)
E/GLSurfaceView(2604):  at android.opengl.GLSurfaceView$DefaultWindowSurfaceFactory.createWindowSurface(GLSurfaceView.java:808)
E/GLSurfaceView(2604):  at android.opengl.GLSurfaceView$EglHelper.createSurface(GLSurfaceView.java:1077)
E/GLSurfaceView(2604):  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1471)
E/GLSurfaceView(2604):  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

我在活動onPause上使用glSurfaceView.onPause,在活動onResume上使用glSurfaceView.onResume。

我最終在每次調用onResume時重新創建GLSurfaceView(或者在第一次調用它時創建它)...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM