2012-03-26 64 views
1

有時,當我退出openGL ES 1應用程序時,以下錯誤消息會在logcat中發佈,並且應用程序凍結,並且在某些時候終止。Android openGL - 表面無效表面

E/EglHelper(4284): Surface is not valid Surface(name=null, identity=-1, mNativeSurface=0) java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface 
E/GLThread(4284): Couldn't create a surface 132184 
W/GLThread(4284): egl createSurface 
W/EglHelper(4284): createSurface() tid=22 

哪裏可能是我的問題?

回答

1

有一件事,你應該檢查看看,如果你還沒有解決這個問題,比較你正在做的Activity onPause/onDestroy回調你在做什麼在SurfaceDestroyed回調。如果您使用GLSurfaceView或標準SurfaceView手動控制OpenGL,則只有在調用surfaceCreated回調函數時才能啓動有效曲面,並在調用surfaceDestroyed時結束。因此,如果在您的應用退出時發生這種情況,您應該看看是否在該表面已經被銷燬後嘗試操縱該表面。

另一個要考慮的是,你的logcat的條目看起來像當試圖調用eglCreateWindowSurface(),所以你可能想看看,爲什麼你想,當你的應用程序創建一個新的OpenGL繪圖表面的異常被拋出退出。

+0

謝謝,你救了我這個謎...... – MyFlashLab 2014-07-12 08:33:23