Jump to content

  • Log In with Google      Sign In   
  • Create Account

Is GL_FRAMEBUFFER_SRGB global state or per framebuffer(object)?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Prune   Members   -  Reputation: 218

Like
0Likes
Like

Posted 12 February 2014 - 06:44 PM

Is GL_FRAMEBUFFER_SRGB global state or applies specifically to the currently bound framebuffer(object)?


"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30424

Like
2Likes
Like

Posted 12 February 2014 - 07:18 PM

AFAIK:

You first need to create your frame-buffer using the GL_SRGB8 or GL_SRGB8_ALPHA8 formats.

 

Then, GL_FRAMEBUFFER_SRGB that can be used to disable linear->sRGB conversions.

If GL_FRAMEBUFFER_SRGB is disabled, then linear->sRGB conversion of pixel shader outputs is never performed.

if GL_FRAMEBUFFER_SRGB is enabled, then linear->sRGB conversion of pixel shader outputs is performed if the framebuffer was created with an sRGB format.



#3 Prune   Members   -  Reputation: 218

Like
0Likes
Like

Posted 12 February 2014 - 08:24 PM

Thanks Hodgman.


"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

#4 samoth   Crossbones+   -  Reputation: 4791

Like
0Likes
Like

Posted 13 February 2014 - 05:42 AM

This is best learned from either ARB_framebuffer_sRGB extension spec or from the wording of the core specification. Both state it like this:

 

If FRAMEBUFFER_SRGB is enabled and the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer attachment corresponding to the destination buffer is SRGB (see section 9.2.3), the R, G, and B destination color values (after conversion from fixed-point to floating-point) are considered to be encoded for the sRGB color space and hence must be linearized prior to their use in blending. Each R, G, and B component is converted in the same fashion described for sRGB texture components in section 8.23.

If FRAMEBUFFER_SRGB is disabled or the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING is not SRGB, no linearization is performed. The resulting linearized R, G, and B and unmodified A values are recombined

 

Also note the comments section in the extension spec (always worth reading these!):

3) Should the ability to support sRGB framebuffer update and blending be an attribute of the framebuffer?
RESOLVED: Yes. It should be a capability of some pixel formats (mostly likely just RGB8 and RGBA8) that says sRGB blending can be enabled.

This allows an implementation to simply mark the existing RGB8 and RGBA8 pixel formats as supporting sRGB blending and then just provide the functionality for sRGB update and blending for such formats.
sRGB support for floating-point formats makes little sense because [blah blah]  support for all fixed-point buffers [...] would require special sRGB conversion hardware.

 

14) How is the constant blend color handled for sRGB framebuffers?
RESOLVED: The constant blend color is specified as four floating-point values. Given that the texture border color can be specified at such high precision, it is always treated as a linear RGBA value.

Edited by samoth, 13 February 2014 - 05:43 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS