安卓 2.1 - 日食
哪些步骤将重现该问题?
1.
Create new Texture(managed) using new Texture(FileHandle, Format, bool);
- glGenTextures is called
- glHandle is created (Logcat: 100271) "bg_plainred.png"
- uploadImageData calls glBindTexture(100271)
Create new Texture(managed) using new Texture(FileHandle, Format, bool);
- glGenTextures is called
- glHandle is created (Logcat: 315638026) "body2.png"
- uploadImageData calls glBindTexture(315638026)
此时,所有带纹理的精灵都正确渲染了。
2.
Call Texture.dispose(); "bg_plainred.png"
- glDeleteTextures(glHandle) (Logcat: glHandle = 100271)
3.
Create new Texture(managed) using new Texture(FileHandle, Format, bool);
- glGenTextures is called
- glHandle is created (Logcat: 100271) "bg_wallpaper.png"
- uploadImageData calls glBindTexture(100271)
Create new Texture(managed) using new Texture(FileHandle, Format, bool);
- glGenTextures is called
- glHandle is created (Logcat: 100271) "clothes.png"
- uploadImageData calls glBindTexture(100271)
所以本质上,createGLHandle() 返回 100271 两次,基本上用衣服.png 覆盖了 bg_wallpaper.png。如果我尝试在 Sprite 中引用“bg_wallpaper”纹理,它显然是从“clothes.png”写入的。
如果我强制上下文丢失和重新聚焦,由于 Gdx 重新加载(管理)纹理,所有纹理都是正确的。
glGenTextures 在纹理中返回 n 个纹理名称。不能保证名称构成一组连续的整数;但是,可以保证在调用 glGenTextures 之前没有使用任何返回的名称。
我的问题是,我是否可以在 GL 中调用任何东西来强制纹理“正在使用”并且不会两次返回相同的 glHandle id?
我不确定这是我应该提交给 libgdx 问题的错误吗?
Texture.java 代码可以参考这里进一步说明:
code.google.com/gdx/src/Texture.java
任何帮助是极大的赞赏!