MANAGED & UNMANAGED (DYNAMIC )TEXTURES IN LIBGDX (OPENGL CONTEXT LOSS)

来源:互联网 发布:js插件 编辑:程序博客网 时间:2024/05/16 13:38

原文链接http://www.badlogicgames.com/wordpress/?p=1073

文章意思大概:

Opengl Context Loss:incoming call、按home键、电源键、进入另一个Activity(即使是半透明的Activity,onPause了就loss了,虽然这时还能看到缓存的图片,但是Activity back回去了就没了)

Managed Textures :有固定位置  eg new Texture(Gdx.files.internal("data/bg.png"));

Unmanaged (Dynamic)Textures: 没固定位置、内容会改变  eg new Texture(pixmap);


Solution:

1.keep an in-memory copy of the original bitmap  used for the texture, apply all your draw calls to that bitmap and upload it to the texture in video ram each time.

2.store a copy on the SD-card, read that in each time you call Texture.draw(), draw the Pixmap to it, upload it to the texture and save the modified image back to the SD card.



0 0
原创粉丝点击