PDA

View Full Version : sRGB and Multi-Sampled Textures



Kastenfrosch2
09-05-2012, 06:30 AM
On a NVidia Card the following works fine, while on an ATI card i get an GL_INVALID_ENUM because of the GL_SRGB8_ALPHA8.



glBindTexture(GL_TEXTURE_2D_MULTISAMPLE,texMS);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 2 ,GL_SRGB8_ALPHA8, windowWidth, windowHeight,true);


(I have an 4.2-Comptibility Context and i am using freeglut and glew)


In the 4.2 Documentation it is said, that glTexImage2DMultisample only accepts color-renderable formats and GL_SRGB is not listed as color-renderable.

So is it true, that i can't have a multisampled sRGB texture?

If so:
Why is it said in the GL_EXT_FRAMEBUFFER_sRGB documentation (http://developer.download.nvidia.com/opengl/specs/GL_EXT_framebuffer_sRGB.txt), that

... if the color samples for multisampling are sRGB encoded ...

If not so:
Did i misread the specification?

Alfonse Reinheart
09-05-2012, 06:42 AM
while on an ATI card

Which ATI card?

Kastenfrosch2
09-06-2012, 02:31 AM
It was a "Mobility HD 5850" and i just noticed, that it only supports OpenGL 3.2. (But Freeglut did complain when i requested a 4.2 context).
But if i request a 3.2 Context, the error is the same.

I also tried it with a HD6750M with 3.2 Context (of a Samsung SUR40, that for some reason doesn't allow me to update the windows-7-provided drivers), which yields the same error.

Does that clarify things?
Where can i read what context supports which internal formats?

Alfonse Reinheart
09-06-2012, 04:59 AM
It was a "Mobility HD 5850" and i just noticed, that it only supports OpenGL 3.2.

Then it sounds like your drivers are very out of date. Being a laptop card, updating the drivers will probably be non-trivial, but you should do that.

Kastenfrosch2
09-06-2012, 06:08 AM
I misinterpreted the information on the ATI product page (http://www.amd.com/us/products/desktop/graphics/ati-radeon-hd-5000/hd-5850/Pages/ati-radeon-hd-5850-overview.aspx#2) stating

OpenGL 3.2 support
that it would be the maximum supported version, i am sorry for this.

Anyhow the drivers are up-to-date and when i start the GL Extension Viewer (http://www.realtech-vr.com/glview/download.php) it tells me that OpenGL 4.2 is supported (explains why freeglut did not complain about the 4.2 context). But no matter which context i set, GL_SRGB8_ALPHA8 yields the error.

Could you in general tell me if it SHOULD be supported and where i could have found this information.

Alfonse Reinheart
09-06-2012, 06:32 AM
The spec says that the internal format must be color-renderable. Which effectively means "no compressed formats".

Kastenfrosch2
09-07-2012, 01:00 AM
I'm sorry, but i don't understand it.

Due to the 3.2 Specification (http://www.opengl.org/registry/doc/glspec32.core.20091207.pdf) (to pick a low versioned example)


internalformat must be color-renderable, depth-renderable, or stencil- renderable
(as defined in section 4.4.4)

Section 4.4.4 sais

The following base internal formats from table 3.11 are color-renderable:
RED, RG, RGB, and RGBA. The sized internal formats from table 3.12 that
have a color-renderable base internal format are also color-renderable

If i now look in table 3.12, it is stated, that SRGB8_ALPHA8 has RGBA as a Base Internal Format.

And if i get Table 3.14 right, the compressed version of SRGB8_ALPHA8 is COMPRESSED_SRGB_ALPHA, so SRGB8_ALPHA8 seems to be an uncompressed format. (The EXT_texture_sRGB spec (http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt) also sais)

This extension adds a few new uncompressed and compressed color
texture formats with sRGB color components.

Could you clarify my confusion?

Alfonse Reinheart
09-07-2012, 06:41 AM
There is nothing confusing about it. SRGB8_ALPHA8 is a color-renderable format. glTexImage2DMultisample takes color-renderable formats. Therefore...

It is a driver bug for a driver to refuse a color-renderable format.

This ain't rocket science here.

Kastenfrosch2
09-08-2012, 01:23 AM
OK, thanks a lot, (i just misinterpreted your last post).