安卓:在GLSurfaceView创建纹理贴图中删除从标准的硬件加速视图元素 [英] Android: creating textures in GLSurfaceView deletes textures from standard hardware accelerated view elements

查看:371
本文介绍了安卓:在GLSurfaceView创建纹理贴图中删除从标准的硬件加速视图元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行游戏 GLSurfaceView 嵌入在一个普通的Andr​​oid的布局。该应用程序后,已运行了一段时间,大量的纹理已经创建,然后再删除(所有显示的文本动态渲染成纹理,如果不使用,再删除),与其他布局元素纹理失去他们的纹理。

i have a game running in a GLSurfaceView embedded in a regular Android layout. After the app has been running for a while and a lot of textures have been created and then later deleted ( all shown texts are dynamically rendered into textures and if not used, deleted again ), textures from the other layout elements lose their textures.

例如textviews或按钮失去了文字的纹理。

For example textviews or buttons lose their text textures.

这似乎是所有的Andr​​oid版本> 3在布局由OpenGL ES的渲染器渲染的问题。

This seems to be a problem of all Android Versions > 3 where the layout is rendered by the OpenGL ES renderer.

游戏贴图曾经迷失非。只有观点的纹理。

Non of the game textures ever get lost. Only the view textures.

glGenTextures glDeleteTextures 是同步的,因此不应该是一个问题。

the glGenTextures and glDeleteTextures are synchronized so that should not be an issue..

有没有别的东西必须照顾混合时经常Android的看法和OpenGL的?

Is there something else one must take care of when mixing regular android views and OpenGL?

推荐答案

由于我在做所有的纹理处理排队到surfaceview无论如何,它不能由引起(如CFlex指出)。

Since I was doing all the texture handling queued to the surfaceview anyway, it could not be caused by that ( like CFlex pointed out).

在结束它是为以下:我打电话的渲染器的构造一些GL方法。然而,该渲染器构造的 的情况下被创建之前,因为渲染器传递给surfaceview以来初始化。因此,GL调用似乎扰乱了输出上下文。

In the end it was to be the following: I was calling some gl methods in the constructor of the renderer. however, the renderer is constructor before the context is created since the renderer has to passed to the surfaceview since on init. So the gl calls seemed to mess up the layout context.

有趣的是,大多数的设备似乎并不关心(比失去的纹理描述的行为除外)。然而,LG P990坠毁在启动时除了一个不创造环境,这给了最后的线索。做GL初始化不是在渲染构造但经过后来的效果就走开了。

funny enough, most devices didn't seem to care ( other than the described behaviour of losing textures). however, the lg p990 crashed on startup with a "context not created" exception and that gave the final clue. after doing the gl initialization not in the renderer constructor but later on the effect went away.

和请。投了CFlex的回答,因为它解决了问题的一个重要的一半。

and please. vote up CFlex's answer since it addresses one important half of the problem.

这篇关于安卓:在GLSurfaceView创建纹理贴图中删除从标准的硬件加速视图元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆