PDA

View Full Version : Questions about non-square compressed mipmap texture in OpenGL



linghuye
04-03-2006, 03:30 AM
I have a 64 * 256 texture file and it is saved in GL_COMPRESSED_RGBA_S3TC_DXT3_EXT format, when I try to reload it into graphic card, I find that it can not work with GL_LINEAR_MIPMAP_LINEAR, this texture is shown all white. But with GL_LINEAR mode, it works good.

I used the following OpenGL commands to build the compressed texture

glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ARB, 64, 256, GL_RGBA, GL_UNSIGNED_BYTE, pRGBAImageData);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &imgSize);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &compressFormat); // Result format GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
glGetCompressedTexImageARB(GL_TEXTURE_2D, level, pData);

the level is called from 0 to 8 for this 64 * 256 texture mipmap, and the width and height for all levels are
64 * 256
32 * 128
16 * 64
8 * 32
4 * 16
2 * 8
1 * 4 // 16 bytes
1 * 2 // 16 bytes
1 * 1 // 16 bytes

I believe the compressed texture data is good and for other SQUARE compressed mipmap textures, this bug never happens.

And I check MSDN about dds layout format, and there is a sample of 256 * 64 texture.
http://msdn.microsoft.com/archive/defaul...umetextures.asp (http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/ddsfilereference/ddsvolumetextures.asp)

So I think I do all the right calls, but why it is still all white, is 1 : 4 mipmap texture suppored in OpenGL?

Tested under Geforce 5200 and 6200 with the lastest driver version 84.21, the bugs are always make me crazy.

I really appreciate any help and tip.

sqrt[-1]
04-03-2006, 04:38 AM
Could you post your code you use to load in the compressed texture? Chances are you are not loading the mip-map data correctly.(or at all)