gpt4 book ai didi

Android openGL - Surface 不是有效的 Surface

转载 作者:行者123 更新时间:2023-11-30 04:16:39 26 4
gpt4 key购买 nike

有时,当我退出我的 openGL ES 1 应用程序时,以下错误消息会不断张贴在 logcat 中,应用程序会卡住,并在某个时候终止。

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

我的问题在哪里?

最佳答案

如果您还没有解决这个问题,您应该检查的一件事是将您在 Activity onPause/onDestroy 回调中所做的与您在 surfaceDestroyed 回调中所做的进行比较。如果您使用 GLSurfaceView 或标准 SurfaceView 来手动控制 OpenGL,则只能保证在调用 surfaceCreated 回调时开始并在调用 surfaceDestroyed 时结束时有一个有效的表面。因此,如果在您的应用程序退出时发生这种情况,您应该查看您是否试图在表面被销毁后对其进行操作。

另一件需要考虑的事情是,您的 logcat 条目看起来像是在尝试调用 eglCreateWindowSurface() 时抛出的异常,因此您可能想了解为什么在应用程序退出时尝试创建新的 OpenGL 绘图表面。

关于Android openGL - Surface 不是有效的 Surface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9878957/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com