android opengl es 1.1 即时纹理压缩
我必须使用纹理压缩,因为我的应用程序当前使用多达 100MB 的 RAM 来存储纹理。
我正在从视图创建纹理,因此不可能以压缩格式创建它们。我如何使用 ETC1/ATC/PVRTC 动态压缩它们并将它们发送到 GPU?我尝试过:
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, ETC1.ETC1_RGB8_OES, bitmap, 0);
我也尝试过我的手机支持的其他压缩格式,但纹理始终是白色的。输入位图是 RGB_565 并且 mip-maps 被禁用。
是否可以将位图作为纹理发送到 opengl es 1.1,以便它在 Android 上自动压缩,就像在 PC 上一样?
i have to use texture compression as my app is currently using up to 100MB of ram for textures.
i am creating textures from Views, so it is not possible for them to be created in a compressed format. how can i compress them with ETC1/ATC/PVRTC on the fly and send them to gpu? i tried:
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, ETC1.ETC1_RGB8_OES, bitmap, 0);
i also tried other compression formats supported by my phone, but the texture is always white. the input bitmap is an RGB_565 and mip-maps are disabled.
is it possible to send a bitmap as a texture to opengl es 1.1 so it gets automatically compressed on android, like it is possible on a pc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Arne Bergene Fossaa 的帮助下,我得到了这个解决方案:
我知道 ETC1Util.compressTexture 和 ETC1Util.loadTexture,但它们提供了损坏的纹理。好消息是,我的本机内存消耗从 100MB 减少到了 26MB。但这个解决方案非常慢。即使它是在具有最小优先级的单独线程上完成的,渲染线程也完全被阻塞。有更有效的方法吗?或者我是否必须在新设备上首次运行时创建这些 ETC1 纹理并将它们保存到 SD 卡以供以后重复使用?
with help from Arne Bergene Fossaa i get to this solution:
i know about the ETC1Util.compressTexture and ETC1Util.loadTexture, but they were giving corrupted textures. good thing is that i went from 100MB down to 26MB with native memory consumption. but this solution is slow as hell. and even though it is done on a separate thread with min priority, the rendering thread is totally blocked. is there a more efficent way? or do i have to create these ETC1 textures on the first run on a new device and save them to SD card for later reuse?
您无法通过 OpenGL ES 执行此操作 - 仅支持 ETC 解压缩。 ETC 压缩要做得又快又好并不是一件简单的事 - 您可以看看 http://devtools.ericsson.com /etc 并在您的程序中实现 etcpack。
You cannot do that through OpenGL ES - only ETC decompression is supported. ETC compression is not really trivial to do fast and good - you might have a look at http://devtools.ericsson.com/etc and implement etcpack in your program, though.