<?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>1381</bug_id>
          
          <creation_ts>2019-05-13 10:50:19 +0200</creation_ts>
          <short_desc>GLReadBufferUtil/AWTReadBufferUtil: &apos;hasAlpha&apos; usage is not functional</short_desc>
          <delta_ts>2023-02-25 18:27:20 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>2.4.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>askinner</cc>
    
    <cc>sgothel</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs>jogl 154e91978498d8b6db9ce34a1f06b298bcf4c361</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>6254</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2019-05-13 10:50:19 +0200</bug_when>
    <thetext>GLReadBufferUtil.readPixelsImpl(..) uses &apos;hasAlpha&apos; to determine 
the &apos;PixelFormat.Composition hostPixelComp&apos; and then modifies it 
based on the &apos;GLPixelAttributes pixelAttribs&apos; composition.

Host and GL pixel composition could be different,
however, this implementation could potentially lead to a different host storage
on the second call w/ &apos;hasAlpha = true&apos;.

Either (1) store the &apos;requestedAlpha&apos; immutable and use it always,
or (2) determine &apos;hasAlpha&apos; with construction.

(2) probably is desired anyways and (1) for better documentation (debugging).
Hence both options probably should be implemented and (2) will also lead to proper host PixelFormat. 

This erroneous behavior is now visible using AWTGLReadBufferUtil,
which can be mitigated using &apos;hasAlpha = true&apos; in the construction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6255</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2019-05-13 11:03:03 +0200</bug_when>
    <thetext>(In reply to Sven Gothel from comment #0)
&gt; Either (1) store the &apos;requestedAlpha&apos; immutable and use it always,
&gt; or (2) determine &apos;hasAlpha&apos; with construction.
&gt; 
&gt; (2) probably is desired anyways and (1) for better documentation (debugging).
&gt; Hence both options probably should be implemented and (2) will also lead to
&gt; proper host PixelFormat. 
&gt; 
&gt; This erroneous behavior is now visible using AWTGLReadBufferUtil,
&gt; which can be mitigated using &apos;hasAlpha = true&apos; in the construction.

(2) &apos;hasAlpha&apos; cannot be determined w/o a valid GL instance or at least GLProfile at construction,
since none is currently passed in the constructor, 
we need to keep &apos;hasAlpha&apos; being lazily evaluated by the first readPixel call.

(1) immutable storage of requestedAlpha will resolve this issue

It is up to the AWTGLReadBufferUtil user to use different pixel formats for host and GL, i.e. RGB stored within 32bit INT on the host side being filled by OpenGL with RGBA or BGRA data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6256</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2019-05-13 11:21:51 +0200</bug_when>
    <thetext>jogl 154e91978498d8b6db9ce34a1f06b298bcf4c361
Keep host PixelFormat functional using requested immutable alphaRequested + add appropriate API doc</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>