[quote]I’m not quite sure what you mean when you say:
" I would suggest to store PNGs and let OpenGL compress them at runtime on the fly "
Do you mean decompress them? I’m assuming if you store PNG, you’re storing a compressed version. Do you mean have openGL decompress them on the fly?
[/quote]
No, sorry for the unclarity. I meant your code which talks to OpenGL, loads and decompresses the PNG (via ImageIO.load to a BufferedImage for example). When it binds the BufferedImage’s databytes to OpenGL it says: compress it (lossy).
[quote]What I never understood w/ OpenGL’s compression stuff is it hides how it does the compression. If it says that it’s done GL_RGBA compression, what exactly does that mean? What’s the format exactly?
[/quote]
I don’t think it hides it away. There are two ways to achieve on-the-fly compression when binding a texture by calling
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internformat, …)
- The more generic way is to let OpenGL decide which compression format it likes most by using the ARB tag by using:
internformat = GL.GL_COMPRESSED_RGB_ARB
It’s mentioned in the other linked thread: after this you can ask what compression it actually used, as well as to which size it compressed the texture, by calling
glGetTexLevelParameteriv(…)
Please see the other thread for details on that.
- You could directly ask for a ST3C compression, by using:
internalformat = GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
For method 1) your card must support “GL_ARB_texture_compression”, while for method 2) it must support “GL_EXT_texture_compression_s3tc”. As said, you can query extensions via gl.isExtensionAvailable(…).
(I don’t right now which of the various DXT1…5 formats a card actually supports when it says it’s got the GL_EXT_texture_compression_s3tc implemented. Because I never uses it.)
[quote]I basically don’t have a GL implementation doing the compression, but I want a GL implementation to do the decompressing and displaying on the screen. How do I make sure that the openGL implementation can decompress the compressed file I provide?
[/quote]
By asking at runtime if the card supports GL_EXT_texture_compression_s3tc and then using the appropriate image-format and internal-format parameters at texture bind time (they’re mentioned somewhere on the Nvidia page as well as the official OpenGL extension registry I think).
The files you can compress to ST3C at deploy time with one of the Nvidia tools I mentioned, for example.