Reduce memory usage for textures in OpenGL ES 1.1

My scene in OpenGL ES requires several high-resolution textures, but they have shades of gray, since I use them only for masks. I need to reduce memory usage.

I tried to load these textures using Bitmap.Config.ALPHA_8 and as RGB_565. ALPHA_8 seems to actually increase memory usage.

Is there a way to get the texture loaded in OpenGL and use it less than 16 bits per pixel?

glCompressedTexImage2D looks like it might be promising, but from what I can tell, different phones offer different texture compression methods. Also, I don't know if compression reduces memory usage at runtime. Is the solution to store my textures in ATITC and PVRTC formats? If so, how can I determine which format the device supports?

Thank!

+3
source share
3 answers

PVRTC, ATITC, S3TC, etc. The native compressed texture of the GPU should reduce memory usage and improve rendering performance.

For example (sorry in C, you can implement it as using GL11.glGetString in Java),

const char *extensions = glGetString(GL_EXTENSIONS);
int isPVRTCsupported = strstr(extensions, "GL_IMG_texture_compression_pvrtc") != 0;
int isATITCsupported = strstr(extensions, "GL_ATI_texture_compression_atitc") != 0;
int isS3TCsupported = strstr(extensions, "GL_EXT_texture_compression_s3tc") != 0;

if (isPVRTCsupportd) {
    /* load PVRTC texture using glCompressedTexImage2D */
} else if (isATITCsupported) {
...

In addition, you can specify supported devices using the texture format in AndroidManifest.xml.

+10

Imagination Technologies (aka PowerVR) PVRTC 4bpp ( ), , PVRTC 2bpp.

, , Android, PVRTextool I8 (.. greyscale 8bpp) , .

+2

ETC1 texture compression is supported on all Android devices with Android 2.2 and higher.

+1
source

All Articles