PDA

View Full Version : glCompressedTexSubImage2D use for real subrect of bigger texture



Bratik
10-08-2012, 06:52 AM
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

arekkusu
10-08-2012, 11:09 AM
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.