1
\$\begingroup\$

I have an ES 2.0 app and would like to use ETC2 texture compression if it is available (i.e. I am running on a device that supports ES 3.0 standard). Is it possible to use ETC2 in ES 1.1/2.0, and if so how can I query if a device supports it? For most forms of texture compression, there is an extension I can query for, but there is no extension for ETC2 since it is built in.

\$\endgroup\$
1
  • \$\begingroup\$ No, you can't use etc2 in ES2, not as far as i know. Probably on Android, but i still don't think so. \$\endgroup\$
    – Raxvan
    Apr 9, 2014 at 15:13

2 Answers 2

3
\$\begingroup\$

There are a bunch of GL extensions related to ETC2 support:

OES_compressed_ETC2_RGB8_texture
OES_compressed_ETC2_sRGB8_texture
OES_compressed_ETC2_punchthroughA_RGBA8_texture
OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
OES_compressed_ETC2_RGBA8_texture
OES_compressed_ETC2_sRGB8_alpha8_texture

The ES3 compatibility extension aggregates those (and a few others). You can query for these extensions to check support, presumably.

\$\endgroup\$
3
  • \$\begingroup\$ Ok I think I misunderstood the extensions. When I open the "OpenGL Extensions Viewer" on android (on the newer Nexus 7), I see "Texture GL_COMPRESSED_RGBA8_ETC2_EAC". So i guess i should look for that when querying the extensions. \$\endgroup\$
    – default
    Apr 9, 2014 at 17:21
  • \$\begingroup\$ Well, except that string is not in the extensions, nor are any of the strings you mentioned (on this qualcomm device). Perhaps if those strings aren't in the extensions, then i can only use ETC2 in an ES 3.0 context? Not sure. \$\endgroup\$
    – default
    Apr 9, 2014 at 17:51
  • 1
    \$\begingroup\$ If the string isn't in the set of extension strings, it's not supported. \$\endgroup\$
    – user1430
    Apr 9, 2014 at 18:13
0
\$\begingroup\$

Pretty late to the show but this is the top google hit for ETC2 on GLES2, and I think the accepted answer isn't really complete.

I think you ought to be querying compressed texture format support rather than extensions. Something like this:

    GLint iNumCompressedFormats = 0;
    glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &iNumCompressedFormats);
    if (iNumCompressedFormats > 0)
    {
        GLint *pCompressedFormats = new GLint[iNumCompressedFormats];
        glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, pCompressedFormats);
        for (int i = 0; i < iNumCompressedFormats; i++)
        {
            switch (pCompressedFormats[i])
            {
            case GL_COMPRESSED_RGBA8_ETC2_EAC:
                printf("GL_COMPRESSED_RGBA8_ETC2_EAC supported\n");
                break;
            ... etc ...
            }
        }
        delete[] pCompressedFormats;
    }

The relevant ETC2 formats you might want to check are: GL_COMPRESSED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .