S3 Texture Compression

Started by
6 comments, last by 21st Century Moose 13 years, 1 month ago
1. Hello, I have to do S3 texture compression using OpenGL. The first problem is that my images are not power of 2, but 2^n + 1 and it seems like my hardware does not accept it. Is there anyway to overcome it? (do not point me to any tools, I know about ATI Compressonator and etc. right now I need to do it in OpenGL myself).

2. Anyway the second problem is extremely worse. When I'm trying to compress 2048 x 2048 texture to DXT1 - it works fine. But when I'm trying 4096 x 4096 - it throws GL_OUT_OF_MEMORY error. Why would it?

3. BTW, somehow "glGetIntegerv" with GL_NUM_COMPRESSED_TEXTURE_FORMATS returns 0, despite this compression works - WTF? :)

Radeon HD 5870
Advertisement
DXT (or S3, it's mostly the same) compression works on 4x4 blocks of texture data, so it requires your texture dimensions to be in multiples of 4. The only reasonable way I can think of to overcome it is to pad textures so that they meet this requirement; otherwise you can't as it violates the format spec.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


DXT (or S3, it's mostly the same) compression works on 4x4 blocks of texture data, so it requires your texture dimensions to be in multiples of 4. The only reasonable way I can think of to overcome it is to pad textures so that they meet this requirement; otherwise you can't as it violates the format spec.


I know how it works, and btw all DXTn algorithms are adapted for non-power of 2 images, so the problem is not here. The only requirement is that your video-card supports non-power of 2 images. According to specification my video-card supports non-power of 2 images, but somehow it doesn't in the action - and that's the first problem.And what about the second problem, how can that be on high-end video-card?
for the 4096, glGet and call GL_MAX_TEXTURE (size) or something like that. You will know if your card can handle a texture that big.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal


for the 4096, glGet and call GL_MAX_TEXTURE (size) or something like that. You will know if your card can handle a texture that big.


Wrong approach, my graphics card can handle that size, I can load even 8192x8192 but ONLY for rendering it. I'm talking about compression and somehow, it throws GL_OUT_OF_MEMORY error when I'm trying to compress textures above 2048x2048.
You say that the glGet() with GL_MAX_TEXTURE is a wrong approach, you say that your the DXTn spec's have been updated for non-power of to textures. But have you actually tried applying these suggestions?

May it will return some useful info, may it won't. And as these aren't really that hard (load a texture with a base of four, calling a glGet()) these should take about 5 min.

At least it will give you some certainty and narrow down the options.




assainator



EDIT:

Have you tried using a tool like gDEBugger to find some extra details about the issue? This might help to.
"What? It disintegrated. By definition, it cannot be fixed." - Gru - Dispicable me

"Dude, the world is only limited by your imagination" - Me

I tested with a DXT5 4096 x 4096 texture + mipmaps and it works fine on my Gf 8600M.
I also tried a DXT1 8192x8192 texture + mipmaps and this works fine as well.

You probably have a driver problem.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
You probably have a driver problem.


My thinking too. The "multiple of 4" thing is definitely a restriction of the S3TC/DXT formats, and while the documentation for GL_EXT_texture_compression_s3tc does state that this restriction is relaxed for OpenGL, assuming that to be the case also assumes a fully conformant driver.

I would be interested in knowing if the OP actually can create and use a non-power-of-2 texture that is a multiple of 4 in it's dimensions. It seems a reasonable way of testing the theory.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement