Jump to content
  • Advertisement
Sign in to follow this  
Haroogan

OpenGL S3 Texture Compression

This topic is 2838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!