Hello Johannes,

I've not forgotten about the FBO/scissor issue, but I think I can answer 
this one without needing to start builds ;)

On 12/10/2015 07:01 AM, Johannes Brunen wrote:
> I would like to write my shader correctly with respect to Gamma
> correction. After spending some time I see two possible routes for that.
>
> 1. Explicitly write the conversions into the shader code, e.g. after
> texture fetch or before writing the fragment color.
>
> 2. Use the OpenGL extensions that provide support for the sRGB color
> space, i.e. EXT_texture_sRGB and ARB_framebuffer_sRGB.
>
> I would like to apply the second case because it simplifies the shader
> code and is expected to provide more performance. Is this case supported
> by OpenSG and if not could we add the missing parts into the framework?

It should be possible to make use of EXT_texture_sRGB simply by setting 
the ExternalFormat and InternalFormat of a TextureObjChunk to one 
defined by the extension.
For a bit more complete support the enum Image::PixelFormat could be 
extended to contain the sRGB formats. There may not even be any changes 
to the code of TextureObjCunk needed.

Support for ARB_framebuffer_sRGB is mostly needed in the native Window 
implementations, since you have to request and sRGB capable framebuffer 
from the window system (GLX/WGL/...). Once you have that it is mostly a 
matter of calling glEnable(GL_FRAMEBUFFER_SRGB). If you use a 
window/context that is not created by OpenSG itself you need to request 
the sRGB framebuffer there.
In order to make this work correctly when rendering to FBOs those and 
the main Window (i.e. application framebuffer) would need to be made 
aware whether they are linear or sRGB so that OpenSG can call 
glEnable/glDisable(GL_FRAMEBUFFER_SRGB) as needed. For FBOs OpenSG could 
look at the format of the color buffer attachments, but the question 
then is what to do when there are multiple and not all have sRGB 
formats? I'm not sure what OpenGL actually does in that case or if that 
is perhaps a case of FRAMEBUFFER_INCOMPLETE?

        Cheers,
                Carsten



------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to