PDA

View Full Version : Texture compression.



prunkdump
06-19-2011, 01:43 AM
Hi !

I would like to compress my texture files on the fly so :

I check the extension :


if (GLEW_ARB_texture_compression)
printf("support texture compression !\n");
else
printf("doesn't support texture compression !\n");


I load my 1024*1024 uncompressed texture :


glGenTextures(1, &compTexture);
glBindTexture(GL_TEXTURE_2D, compTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ARB, (GLsizei)imageWidth, (GLsizei)imageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer);


Opengl give me that the texture is not compressed (return 0) :


glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &texParams);


But when I check the internal format I obtain GL_COMRESSED_RGBA :


glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &texFormat);


And I get an error (not updated Glint texSize) if I query the image size :


glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &texSize);


Any idees what's happen ? (excuse me for my English)

Alfonse Reinheart
06-19-2011, 01:53 AM
Sounds like a driver bug. I doubt many people even use the generic compressed formats; they generally specify what format they want to compress to specifically.