
Texture Compression - PixelInternalFormat
Posted Sunday, 29 March, 2009 - 18:57 by Grasshopper inI would like to use this texture compression:
(http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_...)
COMPRESSED_RGB_S3TC_DXT1_EXT
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?


Comments
Re: Texture Compression - PixelInternalFormat
S3TC is not among of those - is there any good reason why use that instead of the core formats?
No I just wanted to force texture compression.
But there seems to be a different problem.
I tried it in C++ and in C#/OpenTK and
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);gives me 0 formats.
But at http://www.khronos.org/opengles/documentation/opengles1_0/html/glGetInte... it says:
GL_NUM_COMPRESSED_TEXTURE_FORMATS
params returns one value, the number of supportex compressed texture formats. The value must be at least 10.
Running on Ubuntu 9.04, ATI Radeon HD4850, Catalyst, OpenGL 2.1.8575
Re: Texture Compression - PixelInternalFormat
You need to pass GL_COMPRESSED_TEXTURE_FORMATS, not GL_NUM_COMPRESSED_TEXTURE_FORMATS:
GL_COMPRESSED_TEXTURE_FORMATS
params returns GL_NUM_COMPRESSED_TEXTURE_FORMATS values, the supported compressed texture formats. See glCompressedTexImage2D and glCompressedTexSubImage2D.
glGetError should indicate an error of GL_INVALID_ENUM.
Re: Texture Compression - PixelInternalFormat
GL_NUM_COMPRESSED_TEXTURE_FORMATS
params returns one value, the number of supportex compressed texture formats. The value must be at least 10. See glCompressedTexImage2D and glCompressedTexSubImage2D.
Why would this be incorrect? GL_COMPRESSED_TEXTURE_FORMATS gives you the format ids, but I want the number of available formats.
Re: Texture Compression - PixelInternalFormat
Lack of sleep, sorry :)
What video card / drivers are you using?
Re: Texture Compression - PixelInternalFormat
Same with me I guess - that's the "wrong" opengl documentation ...
But I found some sample code, that should work:
http://www.gamedev.net/community/forums/topic.asp?topic_id=491316
Re: Texture Compression - PixelInternalFormat
I dont know why, but on my laptop GL_NUM_COMPRESSED_TEXTURE_FORMATS returns 0 in OpenGL 3.0 context. In "old" 2.1 context it returns 3 - DXT1, DXT3 and DXT5. This happens not only with OpenTK, it's also same with my C++ code.
This is on Vista x64, Nvidia GF8400M GS, driver 182.06.
Re: Texture Compression - PixelInternalFormat
Reading page 119 of the specs (pdf), it seems that that the query should return > 0:
In addition to the specific compressed internal formats listed in table 3.14,
the GL provides a mechanism to obtain token values for all such formats
provided by extensions. The number of specific compressed internal for-
mats supported by the renderer can be obtained by querying the value of
NUM COMPRESSED TEXTURE FORMATS.
Everything from the Geforce 2 and up should support the DXT "specific compressed internal" formats.
Looks like a driver quirk, I'll check what my Ati card returns tomorrow.
Re: Texture Compression - PixelInternalFormat
I'm using Ubuntu here with the newest Catalyst Driver (Opengl 2.1 Context). Card is a Radeon HD4850.
I tried it on a Windows XP laptop and got back "5" (some ATI mobile and using OpenTK).
Re: Texture Compression - PixelInternalFormat
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?
I really think we should add to OpenTK.Graphics.PixelInternalformat
COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
Regardless whether this is in core or not.
Pro:
Con: