Login  Register

Re: GL_FRAMEBUFFER_SRGB and GLJPanel

Posted by Sven Gothel on Feb 12, 2014; 3:40pm
URL: https://forum.jogamp.org/GL-FRAMEBUFFER-SRGB-and-GLJPanel-tp4030329p4031550.html

On 02/12/2014 02:40 PM, cmbruns [via jogamp] wrote:

4)
> Is it possible more me to modify the GLSL fragment shader that GLJPanel uses
> to blit the framebuffer,

This would be a possible solution,
i.e. allow the user to pass a custom fragment shader.

> since this bug has been closed as WONTFIX, and I do
> not have a general workaround? This way I could insert srgb color correction
> into that shader. And that shader could thus apply the correction correctly to
> everything, including glClearColor(), which NEVER gets sRGB correction in
> recent versions of GLJPanel (jogl 2.1+).

The bug reflects the GL states .. not the custom pixel format
which is not compatible w/ AWT.

Pls create a new specific bug report focusing on this issue.

>
> The suggested workarounds do not work for this issue:
>
> 1) I tried wrapping my display method inside
> glEnable(GL_FRAMEBUFFER_SRGB)/glDisable(GL_FRAMEBUFFER_SRGB), but that did not
> seem to help.
>
> 2) I also tried setting the GLJPanel setSkipGLOrientationVerticalFlip(true).
> Sure, my scene is now rendered upside down, but the sRGB color correction
> remains unapplied.
This is the _best_ solution IMHO ..

The sRGB color conversion must be performed by your own GLEventListener,
since AWT does not handle such.

>
> 3) I tried passing "-Djogl.gljpanel.noglsl" to the JVM, but that did not help.

Same as above ..

>
> Do I really need to allocate my own render buffer, render to it, and blit it
> to the screen myself with my own srgb shader, to get physically correct
> lighting in my scene?

This is more an AWT restriction than a JOGL one.

> I feel like this puts me on the road toward writing my
> own replacement for GLJPanel. On Windows and Linux, I am able to kludge a
> non-broken GLCanvas into my Swing application, but on Mac, GLCanvas is
> unusable in a Swing container, so I must use GLJPanel. So Mac is the platform
> I most need a solution for.

Even though I don't like using GLJPanel and AWT at all
it surely is a valid use case.

Your suggested solution (4) seems most desirable IMHO
and easy to implement.

Pls note this in your bugreport
and attach your test code as well.

Maybe you can even add (4), i.e. the custom fragment shader hook
to GLJPanel and give us a git pull request / patch.

Thank you!

~Sven




signature.asc (894 bytes) Download Attachment