jogl - Small sample in opengl es 3, wrong gamma correction -


i have small sample, es-300-fbo-srgb, supposed showing how manage gamma correction in opengl es3.

essentially have:

  • a gl_srgb8_alpha8 texture texture_diffuse
  • a framebuffer gl_srgb8_alpha8 texture on gl_color_attachment0 , gl_depth_component24 texture on gl_depth_attachment
  • the buffer of default fbo gl_linear
  • gl_framebuffer_srgb disabled.

i this

instead of this

now, if recap display metho, do:

  • i render texture_diffuse texture on srgb fbo , since source texture in srgb space, fragment shader read automatically linear value , write fbo. fbo should contain linear values, although srgb, because gl_framebuffer_srgb disabled, no linear->srgb conversion executed.

  • i blit content of fbo default fbo buffer (through program). since texture of fbo has srgb component, on read values wrong gamma operation performed because assumed in srgb space when not.

  • a second gamma operation performed monitor when renders content of default fbo

so image is, if right, twice wrong..

now, if glenable(gl_framebuffer_srgb); instead this

the image looks have been many times srgb corrected..

if i, instead, leave gl_framebuffer_srgb disabled , change format of gl_color_attachment0 texture of fbo, right image..

why not correct image glenable(gl_framebuffer_srgb);?

i think right: net effect of 2 decoding conversions 1 (the 1 in monitor) enough. suppose either driver or code breaks opengl doesn't 'connect dots' properly; perhaps answer helps you:

when call glenable(gl_framebuffer_srgb)?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -