Texture Compression

Hello all,

Have come across a problem with texture compression in OpenGL that i can’t get my head round.

I’m trying to load a DXT3 texture. The system finds the texture and loads it without error but it is rendered ‘white’.

I created the dds file from a .tga using NVDIA texture tools and and ATI TheCompressonator and the issue is the same in both cases.

This is the code I use to define the texture. in_pCompressedTextureFile is a pointer to my dds file reader. The dds file contains only the main texture, with no mipmaps.


    int iWidth = in_pCompressedTextureFile->GetWidth();
    int iHeight = in_pCompressedTextureFile->GetHeight();
    int iSize = ( ( iWidth + 3 ) / 4 ) * ( ( iHeight + 3 ) / 4 ) * 16;
    glCompressedTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, iWidth,iHeight , 0, iSize, in_pCompressedTextureFile->GetData() );

I’ve attached 2 images. The first is the tga ( with alpha channel ), the compressed file and the difference file; all in The Compressonator. The second is the result in my OpenGL program.

Any help would be nice :slight_smile:

This is not white, it is semi-garbage.
Have you checked for GL errors after each GL call ?

Yes, glGetError() returns GL_NO_ERROR.

Are you sure it’s actually DXT3 compressed?

The dds file header says it is.

Do I have to do anything speacial on the shader side ? or is it just like normal texture mapping in glsl ?


I missed the second reserved field in the dds header ! There was an offset of 1 byte in the data :s.

Thanks for the pointers.