ARB_texture_compression internalformat confusion [SOLVED]
I just started meddling with compressed textures (ARB_texture_compression extension). I called TexImage2D with internalformat set to GL_COMPRESSED_RGBA_ARB. Funnily, after everything is doen if I call
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, ℜ_internalfmt);
real_internalfmt is *not* GL_COMPRESSED_RGBA_ARB! With some painstaking experimentation, I found that real_internalfmt is equal to GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. I thought this format was part of the EXT_texture_compression_s3tc extension? Is this behaviour normal? I need to know the correct format if I want to save the compressed texture to disk, so which is it, the s3tc one?
If it helps, I'm on a GF4 MX and both ARB_texture_compression and EXT_texture_compression_s3tc are available.
/edit: BTW, the texture has been compressed (in some way or the other), I can see the difference in output.
[Edited by - deavik on January 20, 2006 7:03:10 AM]
You will have to specify the exact compressed format, as S3TC compression comes in five falvours - DXT1, DXT2, DXT3, DXT4 and DXT5.
DXT1 uses 1 bit alpha (e.g. alpha masking only), DXT2 and DXT4 use premultiplied alpha and are not commonly used. DXT3 is 4 bits uncompressed alpha per pixel and DXT5 is 8 bits per pixel interpolated alpha.
You have to supply the actual internal format such that the driver/GPU know how the texture is encoded.
HTH,
Pat.
DXT1 uses 1 bit alpha (e.g. alpha masking only), DXT2 and DXT4 use premultiplied alpha and are not commonly used. DXT3 is 4 bits uncompressed alpha per pixel and DXT5 is 8 bits per pixel interpolated alpha.
You have to supply the actual internal format such that the driver/GPU know how the texture is encoded.
HTH,
Pat.
Quote:Original post by darookie
... You have to supply the actual internal format such that the driver/GPU know how the texture is encoded. ...
Thanks for the reply, Pat. I'm loading an uncompressed image, with glTexImage2D and telling it to use a compressed internal format. Going with the ARB_texture_compression extension, I thought I could just use GL_COMPRESSED_RGBA_ARB and not bother about DXTn compression techniques ( ... or have I got it all wrong? [oh])
Quote:Original post by deavik
... or have I got it all wrong? [oh]
I had indeed got it all wrong. The ARB_texture_compression spec (which I obviously hadn't read closely enough) says that COMPRESSED_RGBA_ARB is a 'generic' compressed internal format. The programmer should always check what the specific internal format is.
Thanks for the help, Pat and everyone who looked.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement