<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>874</bug_id>
          
          <creation_ts>2013-10-25 21:57:26 +0200</creation_ts>
          <short_desc>GLJPanel does not respect glEnable(GL_FRAMEBUFFER_SRGB)</short_desc>
          <delta_ts>2014-10-23 21:11:00 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>opengl</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Christopher Bruns">cmbruns</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>---</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>3195</commentid>
    <comment_count>0</comment_count>
    <who name="Christopher Bruns">cmbruns</who>
    <bug_when>2013-10-25 21:57:26 +0200</bug_when>
    <thetext>JOGL v2.1 GLJPanel component does not respect (paler coloration caused by) call to glEnable(GL_FRAMEBUFFER_SRGB)
GLCanvas, in contrast does respect GL_FRAMEBUFFER_SRGB.
Also in contrast, JOGL v2.0 also DOES respect GL_FRAMEBUFFER_SRGB, so something changed from v2.0 to v2.1.

This issue affect both Windows 7 and Mac OS X 10.8.5.

For more background, see previous discussion at 
http://forum.jogamp.org/GL-FRAMEBUFFER-SRGB-and-GLJPanel-tp4030329.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3196</commentid>
    <comment_count>1</comment_count>
    <who name="Christopher Bruns">cmbruns</who>
    <bug_when>2013-10-25 22:04:50 +0200</bug_when>
    <thetext>In the earlier forum discussion related to this issue, we came to assume that this issue is related to GLSL flipping of an offscreen render buffer. I now think that assumption may be incorrect.

I spent one day trying to address this issue. The morning was occupied in an ill-chosen attempt to set up a jogl dev environment using recent MSVC11 on Windows. After lunch I switched to Mac OS X dev environment and got much further. I tried programmatically disabling GL_FRAMEBUFFER_SRGB before the framebuffer gets flipped. And I tried skipping the flip entirely. No effect: my test program still shows both a pale square (GLCanvas) and a dark square (GLJPanel).

So I also tried passing &quot;-Djogl.gljpanel.noglsl&quot; to the JVM. Again, the GLJPanel does not respect GL_FRAMEBUFFER_SRGB.

Thus I think this issue arises somplace other than the GLSL buffer flip. So the assumption of my day&apos;s effort may be flawed. My boss will not let me spend more time on this issue so I might not be able to fix it in the near future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3197</commentid>
    <comment_count>2</comment_count>
    <who name="Christopher Bruns">cmbruns</who>
    <bug_when>2013-10-25 22:09:38 +0200</bug_when>
    <thetext>Program to manually test this issue is pasted below.

Desired behavior: Two pale gray squares displayed side-by-side.

Observed undesired behavior: Left square (GLCanvas) is desired pale gray; right square (GLJPanel) is unwanted darker gray.

************

import java.awt.Dimension;
import javax.media.opengl.GL;
import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.awt.GLJPanel;
import javax.swing.BoxLayout;
import javax.swing.JFrame; 

//Demonstration program to show that GL_FRAMEBUFFER_SRGB is not
//respected by GLJPanel in JOGL 2.1. The two displayed boxes should
//be the same brightness. The one on the right is wrongly too dark. 
@SuppressWarnings(&quot;serial&quot;)
public class TestGLJPanelSrgb extends JFrame 
implements GLEventListener
{
	public static void main(String[] args) {
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				new TestGLJPanelSrgb();
			}
		});
	}

	public TestGLJPanelSrgb() {
		GLCanvas glPanel1 = new GLCanvas(); // correct pale brightness
		GLJPanel glPanel2 = new GLJPanel(); // wrong dark brightness
		glPanel1.setPreferredSize(new Dimension(200, 200));
		glPanel2.setPreferredSize(new Dimension(200, 200));
		getContentPane().setLayout(new BoxLayout(
				getContentPane(), BoxLayout.LINE_AXIS));
		getContentPane().add(glPanel1);
		getContentPane().add(glPanel2);
		glPanel1.addGLEventListener(this);
		glPanel2.addGLEventListener(this);
		pack();
		setVisible(true);
	}

	@Override
	public void display(GLAutoDrawable gad) {
		GL gl = gad.getGL();
		gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	}

	@Override
	public void dispose(GLAutoDrawable arg0) {}

	@Override
	public void init(GLAutoDrawable gad) {
		GL2GL3 gl2gl3 = gad.getGL().getGL2GL3();
		// This next line should raise the brightness of the image
		gl2gl3.glEnable(GL2GL3.GL_FRAMEBUFFER_SRGB);
		gl2gl3.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
	}

	@Override
	public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
			int arg4) 
	{} 
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3646</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-01-25 00:39:07 +0100</bug_when>
    <thetext>Duplicate of Bug 842!

Also see:

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/opengl/awt/GLJPanel.java;h=522585f16fe2c07df060f4468e582d805353ecb2;hb=HEAD#l162

I am quite sure it is, hence users need to glEnable/Disable the state manually in their
GLEventListener display method. Not nice, but its working - sorry.

+++
Just for completeness: Best  GLJPanel solution for performance
and compatibility is GLJPanel&apos;s &apos;setSkipGLOrientationVerticalFlip(true)&apos;,
see Bug 904, and referenced git-sha1 commits (incl. unit tests).
+++

*** This bug has been marked as a duplicate of bug 842 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3710</commentid>
    <comment_count>4</comment_count>
    <who name="Christopher Bruns">cmbruns</who>
    <bug_when>2014-02-12 00:18:18 +0100</bug_when>
    <thetext>(In reply to comment #3)
&gt; Duplicate of Bug 842!
&gt; 
&gt; Also see:
&gt; 
&gt; http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/
&gt; opengl/awt/GLJPanel.java;h=522585f16fe2c07df060f4468e582d805353ecb2;
&gt; hb=HEAD#l162
&gt; 
&gt; I am quite sure it is, hence users need to glEnable/Disable the state
&gt; manually in their
&gt; GLEventListener display method. Not nice, but its working - sorry.
&gt; 
&gt; +++
&gt; Just for completeness: Best  GLJPanel solution for performance
&gt; and compatibility is GLJPanel&apos;s &apos;setSkipGLOrientationVerticalFlip(true)&apos;,
&gt; see Bug 904, and referenced git-sha1 commits (incl. unit tests).
&gt; +++
&gt; 
&gt; *** This bug has been marked as a duplicate of bug 842 ***

I disagree with the &quot;its working&quot; comment. I have tried both of the following:

  * ADD gl.glDisable(GL2GL3.GL_FRAMEBUFFER_SRGB); // at the end of display(...)
  * CALL setSkipGLOrientationVerticalFlip(true); // on the GLJPanel

Neither together, nor individually, do either of these approaches work around the GL_FRAMEBUFFER_SRGB problem with GLJPanel.

Perhaps by &quot;its working&quot; you mean that you have modified the test program I posted to work correctly in some way. Could you please show me the code for the workaround? I cannot figure it out on my own. In my hands GL_FRAMEBUFFER_SRGB never works with GLJPanel; I have no workaround for this issue.

Therefore I suspect that this is perhaps NOT a duplicate of bug 842.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4416</commentid>
    <comment_count>5</comment_count>
    <who name="Christopher Bruns">cmbruns</who>
    <bug_when>2014-10-23 21:11:00 +0200</bug_when>
    <thetext>Per the discussion here and in the forum, this issue is not resolved, and the proposed workaround does not actually work around the problem. So I am reopening.

I can also now add that this issue affects both Mac and Windows in JOGL version 2.1.3, and affects at least Windows (I have not tested Mac) in JOGL version 2.2.4.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>