<?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>838</bug_id>
          
          <creation_ts>2013-09-19 20:32:11 +0200</creation_ts>
          <short_desc>glReadPixels is receiving data in the wrong order with certain display drivers</short_desc>
          <delta_ts>2013-10-19 03:07:16 +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>awt</component>
          <version>2</version>
          <rep_platform>pc_all</rep_platform>
          <op_sys>windows</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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="Dennis Cosgrove">dennisc</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>gouessej</cc>
          
          <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>2977</commentid>
    <comment_count>0</comment_count>
    <who name="Dennis Cosgrove">dennisc</who>
    <bug_when>2013-09-19 20:32:11 +0200</bug_when>
    <thetext>We have received multiple reports of strangely colored graphics output from the field.

We have a machine on which we can reproduce the problem in the lab.  Windows 7, 64 bit, Intel(R) HD Graphics driver.

It appears that the color component order for glReadPixels is not receiving what it expects.  The alpha channel certainly seems to be red by this observed incorrect rendering:

  black -&gt; red
  red   -&gt; red
  green -&gt; yellow
  blue  -&gt; magenta

To eliminate our system from the problem, the Gears demo runs perfectly fine when using a GLCanvas, but exhibits the color component order problem when switched to use a GLJPanel.

Certainly the Intel driver has earned its place on the usual suspects list.  This suspicion is strengthened by the fact that glGetting GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE both result in glErrors.

However, the colors are correctly rendered on the exact same machine when using jogl 1.1.1a.  I was hopeful when I discovered that jogl 1 uses GL_UNSIGNED_INT_8_8_8_8_REV (as opposed to GL_UNSIGNED_BYTE in jogl 2).  Sadly, using GL_UNSIGNED_INT_8_8_8_8_REV in jogl 2 did not solve the problem.  Still, the fact that jogl1 can correctly handle this problem gives me hope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2982</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-09-21 05:28:04 +0200</bug_when>
    <thetext>Is this reproducible w/ one of our unit tests, i.e. TestGearsES2GLJPanelAWT,
which performs a &apos;snapshot&apos; via ReadPixels (but w/ 3 components only, you may tweak it) ?

If not, please provide a unit test and probably a trace log of the same,
best w/ latest aggregated build available (-&gt; wiki).

The fallback values:
  3 components:
                dFormat = GL.GL_RGB;
                dType   = GL.GL_UNSIGNED_BYTE;            

  4 components:
                dFormat = GL.GL_RGBA;
                dType   = GL.GL_UNSIGNED_BYTE;            

should work for all platforms and all GL profiles ofc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2983</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-09-21 05:42:53 +0200</bug_when>
    <thetext>(In reply to comment #1)
&gt; Is this reproducible w/ one of our unit tests, i.e. TestGearsES2GLJPanelAWT,
&gt; which performs a &apos;snapshot&apos; via ReadPixels (but w/ 3 components only, you
&gt; may tweak it) ?
&gt; 
&gt; If not, please provide a unit test and probably a trace log of the same,
&gt; best w/ latest aggregated build available (-&gt; wiki).
&gt; 
&gt; The fallback values:
&gt;   3 components:
&gt;                 dFormat = GL.GL_RGB;
&gt;                 dType   = GL.GL_UNSIGNED_BYTE;            
&gt; 
&gt;   4 components:
&gt;                 dFormat = GL.GL_RGBA;
&gt;                 dType   = GL.GL_UNSIGNED_BYTE;            
&gt; 
&gt; should work for all platforms and all GL profiles ofc.

Note: The fallback has been introduced
w/ commit b33bdf41cf53f37203643a8551bf5d94b42a8fab

http://jogamp.org/git/?p=jogl.git;a=commit;h=b33bdf41cf53f37203643a8551bf5d94b42a8fab</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3013</commentid>
    <comment_count>3</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2013-10-01 10:37:41 +0200</bug_when>
    <thetext>(In reply to comment #0)
&gt; We have received multiple reports of strangely colored graphics output from
&gt; the field.
&gt; 
&gt; We have a machine on which we can reproduce the problem in the lab.  Windows
&gt; 7, 64 bit, Intel(R) HD Graphics driver.
&gt; 
Hi

Please can you indicate the version number of your driver and the exact name of your Intel chipset?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3022</commentid>
    <comment_count>4</comment_count>
    <who name="Dennis Cosgrove">dennisc</who>
    <bug_when>2013-10-01 18:54:55 +0200</bug_when>
    <thetext>I have run the junit tests on the offending system.

A summary of the results of TestGearsGLJPanelAWT can be found here:

   http://www.cs.cmu.edu/~dennisc/jogl/bug838/TestGearsGLJPanelAWT.html

Note that only the default capabilities exhibit the problem.

Requesting pixel buffer, or multisampling, or bitmap all seem to get the graphics driver to behave.

I was able to &quot;solve&quot; the problem on our end by adding:

  caps.setPBuffer( true );

for our GLJPanels.

Is there any reason to not do this?  Should this be added to GLJPanel&apos;s constructor within the existing code below?

  // Works around problems on many vendors&apos; cards; we don&apos;t need a
  // back buffer for the offscreen surface anyway
  {
    GLCapabilities caps;
    if (userCapsRequest != null) {
      caps = (GLCapabilities) userCapsRequest.cloneMutable();
    } else {
      caps = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice()));
    }
    caps.setDoubleBuffered(false);
    offscreenCaps = caps;
  }



bonus note 1: the results of the junit tests are available via http://www.cs.cmu.edu/~dennisc/jogl/bug838/results/

bonus note 2: the junit tests eventually threw an exception: http://www.cs.cmu.edu/~dennisc/jogl/bug838/test_run_error.txt</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3023</commentid>
    <comment_count>5</comment_count>
    <who name="Dennis Cosgrove">dennisc</who>
    <bug_when>2013-10-01 18:56:51 +0200</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #0)
&gt; &gt; We have received multiple reports of strangely colored graphics output from
&gt; &gt; the field.
&gt; &gt; 
&gt; &gt; We have a machine on which we can reproduce the problem in the lab.  Windows
&gt; &gt; 7, 64 bit, Intel(R) HD Graphics driver.
&gt; &gt; 
&gt; Hi
&gt; 
&gt; Please can you indicate the version number of your driver and the exact name
&gt; of your Intel chipset?

I sadly have limited access to this machine.  I will report the complete details the next time I have the opportunity.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3043</commentid>
    <comment_count>6</comment_count>
    <who name="Dennis Cosgrove">dennisc</who>
    <bug_when>2013-10-05 01:05:52 +0200</bug_when>
    <thetext>(In reply to comment #4)
&gt; I was able to &quot;solve&quot; the problem on our end by adding:
&gt; 
&gt;   caps.setPBuffer( true );
&gt; 
&gt; for our GLJPanels.
&gt; 
&gt; Is there any reason to not do this?  Should this be added to GLJPanel&apos;s
&gt; constructor within the existing code below?

one reason not to do this is pixel buffers have a serious problem on linux (getWidth and getHeight do not seem to work correctly which will be the subject of a future bug report).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3047</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-10-05 14:54:29 +0200</bug_when>
    <thetext>Dennis .. can you still reproduce the bug w/ latest build, i.e.

maven 2.1.0-rc-20131004
http://jogamp.org/deployment/archive/master/gluegen_726-joal_484-jogl_1098-jocl_854
http://jogamp.org/deployment/archive/master/gluegen_726-joal_484-jogl_1098-jocl_854-signed/

?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>