derkyjadex's picture

Missing PixelInternalFormat value?

Hi,

Not sure whether this is a bug or I'm not doing it quite right so I'm posting here first. I'm porting my OpenGL code over from Tao and I'm down to the final method, CompressedTexImge2D. Previously my code was:

Gl.glCompressedTexImage2D(Gl.GL_TEXTURE_2D, i, Gl.GL_COMPRESSED_RGB_S3TC_DXT1_EXT, levelWidth, levelHeight, 0, compressedSize, imageData);

But PixelInternalFormat doesn't seem to have the matching value for GL_COMPRESSED_RGB_S3TC_DXT1_EXT. There's a CompressedSrgbS3tcDxt1Ext, but this makes my textures come out over saturated (I can't find any documentation on this format so I don't know what it is). The All enum has the correct value for my textures, so for now I'm using;

Tao.OpenGl.Gl.glCompressedTexImage2D((int)TextureTarget.Texture2D, i - skippedLevels, (int)All.CompressedRgbS3tcDxt1Ext, levelWidth, levelHeight, 0, compressedSize, imageData);

Should that enum value be in there or am I trying to do the wrong thing here?


Comments

Comment viewing options

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

Yes, these tokens are missing, will fix. As a rule of thumb, we do not add extension tokens to core functions but compressed textures are an exception - they are just too useful.

About sRGB textures:

Quote:

The sRGB color space is based on typical (non-linear) monitor characteristics expected in a dimly lit office. It has been standardized by the International Electrotechnical Commission (IEC) as IEC 61966-2-1. The sRGB color space roughly corresponds to 2.2 gamma correction. (source)

If an artist authors textures in sRGB color space, these textures will look the same on any sRGB-calibrated monitor. The issue is that OpenGL assumes a linear color space by default, which would cause problems when blending sRGB textures, for example. The various sRGB extensions (core in OpenGL 3.0) compensate for this issue.