I need some help finding information (or an example) of how to use texture compression for Android. I have a lot of PNG's right now and I need to reduce the amount of memory they take up. I was looking at PVR compression but I can't figure out how to use this within OpenGL.
Could some point me in the right direction or offer some examples as I cannot find anything.
回答1:
There are mainly four texture compression types supported on Android:
ETC1 (Ericsson texture compression). This format is supported by all Android phones. But, it doesn't support an alpha channel, so can only be used for opaque textures.
PVRTC (PowerVR texture compression). Supported by devices with PowerVR GPUs (Nexus S, Kindle fire, etc.).
ATITC (ATI texture compression). Used in devices with Adreno GPU from Qualcomm (Nexus One, etc.).
S3TC (S3 texture compression). This texture compression is used in the NVIDIA chipset integrated devices (Motorola Xoom, etc.)
In short, if your textures don't have alpha, you can use ETC1. If they do have alpha, and you want to support all devices, you must have your textures compressed in the other three types and load them according to the device.
This is an ol thread, so I thought I'd update it with the information available on http://devtools.ericsson.com/etc ETC2 is mandatory in the Khronos standards OpenGL ES 3.0 and OpenGL 4.3.
回答3:
You should not use just PVR compression on Android, since that will not work with all models. To get around that you should either only use ETC1 (mandated on all GLES 2.0 devices) or have separate texture packs for separate GPU modes. The android dev guide has a helper class to load the compression format.
Note that you will not get an alpha channel with ETC1 - you can do some fancy fragment shading tricks to get around that by having the alpha channel as a separate texture.
回答4:
Just wanted to point out etc1 isn't supported by all android devices, contrary to what gergonzalez said
Caution: The ETC1 format is supported by most Android devices, but it not guaranteed to be available. To check if the ETC1 format is supported on a device, call the ETC1Util.isETC1Supported() method.