PDA

View Full Version : Save compressed texture



capedica
04-26-2005, 12:39 AM
Hi,
i have an application that uses 200 textures and more, now i'd like to try compressed textures on this application without making conversion by hand, in my application i can read from dds file compressed texture, does someone knows a way (or sample code) to make a compressed texture from a pixmap (and saved in a dds file)?
Thank you

T101
04-26-2005, 03:08 AM
Don't know any of the details, but the DXT texture compression extension spec raised the question of whether users should be able to read back the compressed texture, and the answer was Yes.

So it sounds like there must be a way to read back the compressed texture from 3D memory.

knackered
04-26-2005, 03:15 AM
Here's a simple example:-


GLint imageFormat=0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &imageFormat);

GLint dataSize=0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &dataSize);

unsigned char* imageData = (unsigned char*)malloc(dataSize);
glGetCompressedTexImageARB(GL_TEXTURE_2D, 0, imageData);BTW, isn't OpenGL beautiful?
You should see the dx code...