View Full Version : glCompressedTexSubImage2D and DXT1

mirv the Silly Fish
09-14-2008, 10:26 AM
Hopefully a simple question: I've had some problems updating a dxt1 compressed image (it fails sometimes, works on others, always works if I update the entire texture in small blocks), but have read some conflicting data as to possible reasons.
I update in 128x128 blocks along pixel boundaries of multiples of 4, however I've noted some people say it should be multiples of 4, but then mention it should be a power of 4.
So I'm curious as to which it should be: a multiple of 4, or a power of 4? Note that I haven't tried swapping in 256x256 blocks yet, as even if that works, I'm more curious as to what it's supposed to be.

09-14-2008, 01:23 PM
I have never used glCompressedTexSubImage2D to upload parts of compressed images, so i cannot help you with your problem, that it sometimes fails.

However, DXT compressed textures need to be updated with multiples of 4, not powers of 4. That is because each block contains a 4x4 pixel region. Each block is, however, completely independent from all other blocks in the texture, so in general, as long as you don't accidentally update data not aligned to those 4x4 blocks, it should work fine.


mirv the Silly Fish
09-15-2008, 12:39 PM
I suspected as much, and have since found my mistake (not initialising a variable of all things). Thanks for the info, as I said, I was just confused a little about it.