Using DDS format for textures

Hi!

I would like to use DDS format for textures in my OpenGL app. As far as I understand DDS has different rows order than glTexImage2D needs.
So while for uncompressed images to change the order is not difficult for compressed ones it’s not an easy thing to do. So what is the best solution? I don’t like to keep textures in DDS already flipped.

Thanks.

You can use OpenGL Texture Matrix to change tex coords for DDS compressed files.

Alternatively flip non-dds textures so that row-order matches. It all depends on what row-order you prefer.

It’s not extremely hard to flip compressed dds files either if you consider that an option. The s3tc format is quite simple, full details are in the GL_EXT_texture_compression_s3tc spec. Basically, for DXT1, every block has 32bit lookup table and 32bit address bits. The lookup table does not need to be altered, but the address bits need to be flipped. 2bits per pixel, each byte is four pixels, that is a full row within the block. So basically you just need to flip the byte order.

Even easier, you know full well that your compression program is going to flip stuff, so do another flip before you compress your textures.

Korval: if I have the choice between using a manual procedure where artists can have accidents, and an automatic solution, I’ll choose the automatic solution everytime.

Note: I haven’t found any code to compress S3TC as well as the Photoshop plug-in does, hence I like artist-saved DDS files.