All,
Reading the OpenGL specifications for NV_texture_compression_vtc, it seems that it should be possible to upload a sub-region of a volume texture. This does work, however if the depth of that texture is not a multiple of 4 there seems to be no way to update the last slices of the texture.
The following code shows this … in short, I have found no way to upload the last slices of a texture if the depth is not a multiple of 4 slices.
GLuint texture_obj;
glGenTextures( 1, &texture_obj );
assert( glGetError() == GL_NO_ERROR );
glBindTexture( GL_TEXTURE_2D, texture_obj );
assert( glGetError() == GL_NO_ERROR );
glTexImage3D( GL_TEXTURE_3D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 1920, 1080, 90, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
assert( glGetError() == GL_NO_ERROR );
const int posn[] = { 0, 0, 88 };
const int size[] = { 1920, 1080, 2 };
const int block_size = (size[0]/4)*(size[1]/4)*size[2]*16;
void* p_mem = ::malloc( block_size );
glCompressedTexSubImage3D( GL_TEXTURE_3D, 0, posn[0], posn[1], posn[2], size[0], size[1], size[2], GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, block_size, p_mem );
assert( glGetError() == GL_NO_ERROR ); /* This always fails */
For the records, the following is from the vtc specifications :
Note the restrictions on CompressedTexSubImage3D depth and zoffset must be multiples of 4 still exist because the block is a 3D 4x4x4 block (or 4x4x2 and 4x4x1 in the end cases).
It clearly seems that the 4x4x2 and 4x4x1 blocks at the end of the texture should be supported.
Thanks in advance for any help.
Andrew