PDA

View Full Version : what's the deal with compressed textures?



therealremi
01-01-2007, 04:37 AM
I mean, OpenGL wants the texture data to be unpacked and in this order: RGB or RGBA and so on for each pixel. So if I load all textures at once at the beginnig of my app, then what can I benefit from compression? Decompressing only takes time and OpenGL wants decompressed texture data.

Komat
01-01-2007, 05:42 AM
The OpenGL has special internal formats (e.g. GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) and api functions (e.g. glCompressedTexImage2D) that can be used to specify the compressed data directly in one from supported formats.

V-man
01-01-2007, 08:10 AM
Are you talking about DXT?

DXT would be pretty useless if you have to decompress. Read about how to send compressed texture to GL http://opengl.org/registry/specs/EXT/texture_compression_s3tc.txt

Basically, your code will look something like this
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, imageSize, data);

therealremi
01-01-2007, 09:49 AM
Hmm, there are some extensions that allow sending compressed texture data to OpenGL then. I did not know that. I hope they are widely supported on chips like GeForceFX and better?

Korval
01-01-2007, 12:52 PM
Hmm, there are some extensions that allow sending compressed texture data to OpenGL then. I did not know that. I hope they are widely supported on chips like GeForceFX and better?They were widely supported five years ago. Don't concern yourself about it.

yossi
01-01-2007, 09:12 PM
I made some experiments on rendering compressed textures on my NVidia fx5700. It was about 20 precents faster than rendering a non comressed RGB texture. So probably the time taking to render a comressed texture on the fly (decompressing and rendering it)is smaller than the time it takes to fetch a much bigger non compressed texture into GPU internal cache. As you said, you pay only once when loading the compressed texture the first time into the GPU (if it is in a non compressed format) and the benifit may be in rendering time.