glCompressedTexSubImage2D use for real subrect of bigger texture

Hi,
I read spec and exceptions, but I’m not sure still. Is it possible to use glCompressedTexSubImage2D for place smaller texture into bigger texture? For example… I have texture 512x512 and 4 textures 256x256. I want to create atlas of texture dynamically right through the code. Everything works fine with glTexSubImage2D, but with glCompressedTexSubImage2D not.

Maybe is because compressed textures are more complex and it’s not possible to find the location for smaller compressed texture into bigger. How can I solve the problem if I need to use dynamic generated atlases + PVR textures? Seems it’s not possible. Two options:

use much more draw calls and PVRs textures or standard textures from png file for example. Am I right?

Thanks… Lucas

The restrictions on CompressedTexSubImage depend on the format.

The general rules are described in the ARB_texture_compression spec which disallows partial SubImage by default (see Issue 5).
This rule may be relaxed by format-specific extensions. For example see EXT_texture_compression_s3tc which allows any subimage aligned to 4x4 blocks (see Issue 3).

If you are using PVRTC, you are out of luck. This format inherently requires neighboring blocks to decompress, so you can not edit individual blocks. See IMG_texture_compression_pvrtc language about CompressedTexSubimage.