Hello,
The recent line of Catalyst drivers really improved the compatibility with OpenGL. However the following OpenGL command does not seem to work properly in conjunction with the GL_TEXTURE_2D_ARRAY_EXT extension:
glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, ... )
No matter what formats we try, we only get a black 3D texture. However if we feed uncompressed image data and let the driver to the DXT compression using glTexImage3D, the texture looks just fine. It seems like the command glCompressedTexImage3D is not yet supported? The same code works just fine on NVIDIA 3D cards, so I assume we are doing everything „correct“.
Could you give us an estimate if and when this command is implemented?
Regards,
Hans
Could you show how let the driver do the DXT compression for 3D textures when feeding it with uncompressed voxels?
const int NIMAGES = 4;
const int texsize = 1024;
const int num_mipmaps = 10;
GLuint texture;
glGenTextures( 1, &texture );
glBindTexture( GL_TEXTURE_2D_ARRAY_EXT, texture );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); //GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); //GL_NEAREST_MIPMAP_NEAREST );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
//glTexParameterf( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8 );
//glGenerateMipmapEXT( GL_TEXTURE_2D_ARRAY_EXT );
glTexImage3D( GL_TEXTURE_ARRAY_EXT, 0, GL_RGB, texsize, texsize, NIMAGES, 0, GL_RGB, GL_UNSIGNED_BYTE );
for (int j=0; j<num_mipmaps; j++)
{
const int tsize = texsize >> j;
// mem is a pointer to the image data. code is not shown here
// this works fine on ATI catalyst 9.3 drivers, if we feed non compressed data and let the driver do the compression
int size = tsize*tsize*3;
glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, j, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, tsize, tsize, NIMAGES, 0, GL_RGB, GL_UNSIGNED_BYTE, mem );
// and this doesn't work (same code works on nvidia drivers however)
int size = ((tsize+3)/4)*((tsize+3)/4)*8;
glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, j, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, tsize, tsize, NIMAGES, 0, NIMAGES*size, mem );
}
Hello,
I would like to put this post to the top again. Is there any official reading this forum who might give me an answer?
We are looking into this, do you have an example?
Hello Byron,
thanks for your reply. Well my above code example basically demonstrates the effect. If you create a 3 dimensional texture as shown and use glCompressedTexImage3D to send DXT1 compressed data to the texture, then the texture is only black on current ATI Catalyst driver 9.4. If you do the same but instead of using glCompressedTexImage3D you use glTexImage3D and send normal RGB data to the texture, everything works just fine. I am using a ATI Radeon 4870 on Windows XP x64. The same code works fine on NVIDIA cards.
Following is the code snippet again with some more comments:
// we want a texture array with the dimensions 1024x1024x4
// we also have the variable mem point to a DXT1 compressed memory
// location that specifies the whole texture. this could be a DDS texture
// loaded from disc.
const int NIMAGES = 4;
const int texsize = 1024;
const int num_mipmaps = 10;
GLuint texture;
glGenTextures( 1, &texture );
glBindTexture( GL_TEXTURE_2D_ARRAY_EXT, texture );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); //GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri( GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT);
// tell opengl the total dimensions of our texture
glTexImage3D( GL_TEXTURE_ARRAY_EXT, 0, GL_RGB, texsize, texsize, NIMAGES, 0, GL_RGB, GL_UNSIGNED_BYTE );
// send each mipmap level to the graphics card
for (int j=0; j<num_mipmaps; j++)
{
const int mipmap_size = texture_size >> j;
// mem is a pointer to the image data. code is not shown here
// OK. this works fine on ATI catalyst 9.4 drivers, if we feed non compressed data and let the driver do the compression
int size = mipmap_size*mipmap_size*3;
glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, j, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, mipmap_size, mipmap_size, NIMAGES, 0, GL_RGB, GL_UNSIGNED_BYTE, mem );
// FAIL. texture looks black if we send compressed data to the card
// (same code works on nvidia drivers however)
int size = ((mipmap_size+3)/4)*((mipmap_size+3)/4)*8;
glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, j, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, mipmap_size, mipmap_size, NIMAGES, 0, NIMAGES*size, mem );
}
...Just updating...
This should have been resolved with a new graphics driver...
It's September 2013, and using
glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY, i, GlobalInternalFormat, x, y, Tex->ArraySize, 0, LevelDataSize, Texture3DLevels );
Still doesn't work as intended. Using
glCompressedTexSubImage3D( GL_TEXTURE_2D_ARRAY, i, 0, 0, TextureLayer, x, y, 1, GlobalInternalFormat, buffer_size, DataPointer );
Works for individual textures, but I was trying to upload everything in one blow, and it all looks black if I use the first function.