Reduce memory use for textures in OpenGL ES 1.1

后端 未结 3 1559
傲寒
傲寒 2021-02-01 00:11

My scene in OpenGL ES requires several large resolution textures, but they are grayscale, since I am using them just for masks. I need to reduce my memory use.

I have t

相关标签:
3条回答
  • 2021-02-01 00:23

    PVRTC, ATITC, S3TC and so forth, the GPU native compressed texture 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) {
    ...
    

    Besides you can specify supported devices using texture format in AndroidManifest.xml.

    • The AndroidManifest.xml File - supports-gl-texture

    EDIT:

    • MOTODEV - Understanding Texture Compression
    0 讨论(0)
  • 2021-02-01 00:37

    With Imagination Technologies-based (aka PowerVR) systems, you should be able to use PVRTC 4bpp and (depending on the texture and quality requirements) maybe even 2bpp PVRTC variant.

    Also, though I'm not sure what is exposed in Android systems, the PVRTextool lists I8 (i.e. greyscale 8bpp) as target texture format, which would give you a lossless option.

    0 讨论(0)
  • 2021-02-01 00:45

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

    0 讨论(0)
提交回复
热议问题