Reduce memory use for textures in OpenGL ES 1.1

后端 未结 3 1563
傲寒
傲寒 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

提交回复
热议问题