Grasshopper's picture

Texture Compression - PixelInternalFormat

I would like to use this texture compression:


But there seems to be no enum for it?

Additionally I checked the extensions for "GL_EXT_texture_compression_s3tc" and I have that but

GL.GetInteger(GetPName.NumCompressedTextureFormats, out numFormats);

gives me 0 formats.

Any ideas?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

PixelInternalFormat.CompressedRgba and CompressedTexImage2D seems to work fine here.

If you wish to use a non-core token (ending in _ARB or _EXT, etc), you'll have to cast it from the All enum.

Inertia's picture

You have to cast explicitly atm, only the sRGB s3tc formats are available in the InternalFormat enum. (Don't ask me why)

Edit: Getting old it seems -.-

objarni's picture

How widely supported is the texture compression algorithms..? I'm thinking if I should just have it as default in my TexUtil-class..

Inertia's picture

Support is superb, it's even available on Intel hardware. (!!!!)

But you should consider reading

objarni's picture

Whoa even Intel :)

Thx I'll check it out Inertia!

the Fiddler's picture

Pretty much everything from the last 10 years supports using compressed textures. Only some drivers support compressing uncompressed textures on the fly. Software Mesa3D supports neither.

Note that compressed textures with high frequency details tend to have noticeably worse appearance (and noticeably better performance).

See page 125 of the specs for the table of supported (core) compressed formats. S3TC is not among of those - is there any good reason why use that instead of the core formats?

objarni's picture

Argh -- I'm on VirtualBox+WinXP on a Ubuntu computer, so I guess I'm using software Mesa (Generic GDI is the renderer name) when testing my progs virtually.

That might prove to be a "stumbling block" for the development of games for me, if I wanted to use compressed textures. (to much hassle flipping back-and-front to the host OS all the time to test the compiled program)

the Fiddler's picture

Even worse, you are on Microsoft's GDI renderer.

Install the latest VirtualBox and enable accelerated 3d in your virtual machine settings. VirtualBox 2.1.4 supports OpenGL 1.5 (including compressed textures IIRC) and VirtualBox 2.2 (beta) supports something like OpenGL 2.0. Much better.

objarni's picture

Inertia - I read through most of the book page, nice explanation!

So if I understand the book page correctly - to use compressed textures, I have to convert my .png-files to .dds files?

the Fiddler's picture

For best performance and quality, yes. You can also have the driver compress the texture on the fly, but a) this is going to impact your loading performance and b) on the fly compression is not supported by open-source drivers (due to patents on the compression format).

Personally, I compress all my textures with gimp before adding them to the project (don't forget to keep the originals around in case you want to tweak the texture later on!) Quake 3 / Doom 3, on the other hand, compress on the fly.