This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why can I not load compressed textures created with astc-encoder in glCompressedTexImage2D?

Hi,

For some reason, I cannot seem to load textures created with astc-encoder (from ARM-software/astc-encoder · GitHub ) using glCompressedTexImage2D on an Android device. (Using the Oculus Mobile SDK)

I am creating the textures with this command:

astcenc -c anim_texture.0001.tga anim_texture.0001.astc 8x8 -thorough

(actually a for loop running this command for a large number of textures, but this illustrates it...)

Here is the output of astcenc encoding one of those textures:

=====

Encoding settings:

2D Block size: 8x8 (2.00 bpp)

3D Block size: 8x8x1 (2.00 bpp)

Radius for mean-and-stdev calculations: 0 texels

RGB power: 1

RGB base-weight: 1

RGB local-mean weight: 0

RGB local-stdev weight: 0

RGB mean-and-stdev mixing across color channels: 0

Alpha power: 1

Alpha base-weight: 1

Alpha local-mean weight: 0

Alpha local-stdev weight: 0

RGB weights scale with alpha: disabled

Color channel relative weighting: R=1 G=1 B=1 A=1

Block-artifact suppression parameter : 0

Number of distinct partitionings to test: 100 (preset)

PSNR decibel limit: 2D: 42.682579 3D: 42.682579 (preset)

1->2 partition limit: 2.500000

Dual-plane color-correlation cutoff: 0.950000 (preset)

Block Mode Percentile Cutoff: 95.000000 (preset)

Max refinement iterations: 4 (preset)

Thread count : 12 (autodetected)

anim_texture.0001.tga: 2D LDR image, 4096 x 4096 x 1, 3 components

262144 blocks to process ..

262143

=====

In my source code, I am loading the texture like this:

glCompressedTexImage2D(GL_TEXTURE_2D, 0, /* target, level */ 
                       GL_COMPRESSED_RGBA_ASTC_8x8_KHR, /* internal format */
                       4096, 4096, 0, /* width, height, border */
                       4194320, /* size */
                       buffer /* pixels */);

The textures are all exactly 4096x4096 texels in dimension, 4194320 is the length of the compressed texture files astcenc has produced, in bytes, and buffer is a pointer to the contents of one of those texture files, with no modifications.

Running this fails, giving the gl error GL_INVALID_VALUE (0x501) from glGetError().

Meanwhile, a coworker of mine has produced some ASTC compressed textures using the Unity engine, and those work flawlessly with my code. (Although they are upside down for some reason... Not a big deal, though.)

Is there something I'm missing here? Do the texture files created by astcenc maybe contain some kind of header that should not be including when setting the actual texture?

Parents Reply Children