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
texturetexture_diffuse
- a framebuffer
gl_srgb8_alpha8
texture ongl_color_attachment0
,gl_depth_component24
texture ongl_depth_attachment
- the buffer of default fbo
gl_linear
gl_framebuffer_srgb
disabled.
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, becausegl_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
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:
Comments
Post a Comment