GlThread比较常见的问题

问题描述:GlSurfaceView运行一段时间之后就会停止渲染,main线程还在继续运行,界面没有反应

经调试发现报错log:

E AndroidRuntime: java.lang.RuntimeException:eglSwapBuffers failed: EGL_BAD_SURFACE
E AndroidRuntime:  atandroid.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1105)
E AndroidRuntime:  atandroid.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1063)
E AndroidRuntime:  atandroid.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1406)
E AndroidRuntime:  atandroid.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1144)

经搜索之后在swap中添加buffer替换出错情况判断,主要参考一下几个网址(大图等容易引起错误)

http://blog.sina.com.cn/s/blog_572dea1a01010d49.html

http://stackoverflow.com/questions/6039107/android-glsurfaceview-egl-bad-alloc

https://github.com/nicolasgramlich/AndEngine/issues/40

### 回答1: 串,该如何实现? 你好!关于你的问题,可以使用Python的字符串方法startswith()进行匹配。具体实现代码如下所示: ``` list = ['sg.bigo.live', 'GLThread 2646', 'GLThread 2639', 'BigoAudioDevMan', 'Thread-870', 'encode_thread'] result = [s for s in list if s.startswith('GLT')] print(result) ``` 运行结果如下所示: ``` ['GLThread 2646', 'GLThread 2639'] ``` 这样就可以匹配出所有以字符串‘GLT’开头的字符串了。希望能够帮到你! ### 回答2: 可以使用Python的列表推导式来匹配list中以字符串'GLT'开头的字符。具体实现如下: ```python list = ['sg.bigo.live','GLThread 2646','GLThread 2639', 'BigoAudioDevMan', 'Thread-870', 'encode_thread'] matched_strings = [string for string in list if string.startswith('GLT')] ``` 上述代码中,通过列表推导式对list中的每个字符串进行遍历,如果字符串以'GLT'开头,则将其添加到新的列表matched_strings中。最终,matched_strings中存储的就是以字符串'GLT'开头的字符。 注意,列表推导式可以简洁地实现匹配操作,但也可以使用传统的for循环遍历list并进行匹配。 ### 回答3: 可以使用列表推导式来实现匹配以字符串'GLT'开头的字符。代码如下: ```python list = ['sg.bigo.live','GLThread 2646','GLThread 2639', 'BigoAudioDevMan', 'Thread-870', 'encode_thread'] result = [string for string in list if string.startswith('GLT')] print(result) ``` 运行结果为: ``` ['GLThread 2646', 'GLThread 2639'] ``` 解释:列表推导式 `[string for string in list if string.startswith('GLT')]` 遍历了列表中的每个元素,判断每个元素是否以字符串'GLT'开头,如果是,则将其添加到结果列表中。最后打印结果列表,即可得到匹配结果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值