<?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>649</bug_id>
          
          <creation_ts>2012-12-03 16:02:12 +0100</creation_ts>
          <short_desc>Clear FBO layer at creation</short_desc>
          <delta_ts>2015-10-04 02:46:17 +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>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>1206</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="ac">andres.colubri</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>gouessej</cc>
    
    <cc>xerxes</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>2026</commentid>
    <comment_count>0</comment_count>
    <who name="ac">andres.colubri</who>
    <bug_when>2012-12-03 16:02:12 +0100</bug_when>
    <thetext>When using NEWT and the new FBO layered mechanism (https://jogamp.org/bugzilla/show_bug.cgi?id=634) the window shows garbage left in the framebuffer. The garbage appears right at the moment when the NewtCanvasAWT is attached to the parent frame during surface initialization (frame.add(canvas, BorderLayout.CENTER)), and cleared at the end of the fist frame when the fb is swapped. But the garbage shouldn&apos;t be displayed in the first place. Some relevant discussion in the forum:

http://forum.jogamp.org/Clearing-NewtCanvasAWT-td4026943.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2120</commentid>
    <comment_count>1</comment_count>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-01-22 23:41:41 +0100</bug_when>
    <thetext>I think I found a potential solution for this issue. In the TextureAttachment.initialize() function in FBObject.java, I replaced

gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, format, getWidth(), getHeight(), 0, dataFormat, dataType, null);

with:

int[] blank = new int[getWidth() * getHeight()];
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, format, getWidth(), getHeight(), 0, dataFormat, GL.GL_UNSIGNED_BYTE, IntBuffer.wrap(blank));

to make sure that the FBO texture is filled out with zeros.

This appears to solve the garbage issue when creating the surface using NEWT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2149</commentid>
    <comment_count>2</comment_count>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-02-05 17:49:10 +0100</bug_when>
    <thetext>In case it is useful, I&apos;m attaching a patch with the changes I mentioned earlier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2150</commentid>
    <comment_count>3</comment_count>
      <attachid>409</attachid>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-02-05 17:51:08 +0100</bug_when>
    <thetext>Created attachment 409
Clears the FBO texture</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2171</commentid>
    <comment_count>4</comment_count>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-02-12 22:47:30 +0100</bug_when>
    <thetext>I added a defaultColor field to GLCapabilities so that a custom color can be passed to JOGL in order to initialize drawing surfaces (i.e.: texture attachements in FBObject). The patches for FBObject.java. GLCapabilites.java and GLCapabilitesImmutable.java are added below.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2172</commentid>
    <comment_count>5</comment_count>
      <attachid>410</attachid>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-02-12 22:49:23 +0100</bug_when>
    <thetext>Created attachment 410
Patch that adds a default color field to GLCapabilities</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2317</commentid>
    <comment_count>6</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-03-20 11:04:42 +0100</bug_when>
    <thetext>Updated the [manual] tests:
  http://jogamp.org/git/?p=jogl.git;a=commit;h=30b2490eef5069214eb6cc0c1b18ddb62c15123b

Invoking:
  java com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT \
     -time 10000 -noanim -layeredFBO -layout BorderCenter

I don&apos;t see no more artifacts, which is due to cleaning up the main-thread CALayer initialization
and waiting for the rendering result _before_ passing the texture to the CALayer.

Please validate .. 

If the artifact (dirty FBO texture) is still visible, please give me instructions how to reproduce.
In such case I would favor better synchronization and maybe an extra display after init
then exploding GLCapabilities and adding a dummy FBO-tex &apos;clear&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2318</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-03-20 11:05:49 +0100</bug_when>
    <thetext>This aggregated build is pretty recent:
  http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936-jocl_761/

.. but doesn&apos;t contain the mentioned unit test tweak to disable animation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2367</commentid>
    <comment_count>8</comment_count>
    <who name="ac">andres.colubri</who>
    <bug_when>2013-03-27 14:26:02 +0100</bug_when>
    <thetext>Thanks for the recent updates, I will take a look at the latest builds in the next few days and will let you know how it goes.

(In reply to comment #7)
&gt; This aggregated build is pretty recent:
&gt;  
&gt; http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936-
&gt; jocl_761/
&gt; 
&gt; .. but doesn&apos;t contain the mentioned unit test tweak to disable animation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2425</commentid>
    <comment_count>9</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-05 02:01:16 +0200</bug_when>
    <thetext>(In reply to comment #8)
&gt; Thanks for the recent updates, I will take a look at the latest builds in
&gt; the next few days and will let you know how it goes.
&gt; 
&gt; (In reply to comment #7)
&gt; &gt; This aggregated build is pretty recent:
&gt; &gt;  
&gt; &gt; http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936-
&gt; &gt; jocl_761/
&gt; &gt; 
&gt; &gt; .. but doesn&apos;t contain the mentioned unit test tweak to disable animation.

Version 2.0.2-rc-20130404
  - Maven 2.0.2-rc20130404
  - http://jogamp.org/deployment/archive/master/gluegen_656-joal_420-jogl_951-jocl_773/

- OSX CALayer / Java7 issues should be fixed w/ this version &apos;once and for all&apos;
  - repaint() component after CALAyer attachment, 
    to avoid garbage and to have rendering result w/o animator
  - run root CALayer ops on main-thread to avoid late GC
  - NewtCanvasAWT/CALayer position fix: Force re-layout via resize</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4230</commentid>
    <comment_count>10</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-18 05:32:34 +0200</bug_when>
    <thetext>Note: Clearing framebuffer of newly created GLFBODrawable instances 
using the current clear color is now implemented due to 
workaround Bug 1020.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>409</attachid>
            <date>2013-02-05 17:51:08 +0100</date>
            <delta_ts>2013-02-12 22:49:23 +0100</delta_ts>
            <desc>Clears the FBO texture</desc>
            <filename>fbo-clear-tex.patch</filename>
            <type>application/octet-stream</type>
            <size>966</size>
            <attacher name="ac">andres.colubri</attacher>
            
              <data encoding="base64">LS0tIHNyYy9qb2dsL2NsYXNzZXMvY29tL2pvZ2FtcC9vcGVuZ2wvRkJPYmplY3QuamF2YS5vcmln
CTIwMTMtMDItMDUgMTE6Mjk6NTkuMDAwMDAwMDAwIC0wNTAwCisrKyBzcmMvam9nbC9jbGFzc2Vz
L2NvbS9qb2dhbXAvb3BlbmdsL0ZCT2JqZWN0LmphdmEJMjAxMy0wMi0wN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
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>410</attachid>
            <date>2013-02-12 22:49:23 +0100</date>
            <delta_ts>2013-02-12 22:49:23 +0100</delta_ts>
            <desc>Patch that adds a default color field to GLCapabilities</desc>
            <filename>Default-color-patch.zip</filename>
            <type>application/zip</type>
            <size>2025</size>
            <attacher name="ac">andres.colubri</attacher>
            
              <data encoding="base64">UEsDBBQACAAIAAyETEIAAAAAAAAAAAAAAAAcABAARkJPYmplY3QtZGVmYXVsdC1jb2xvci1wYXRj
aFVYDACnuBpR6LQaUfUBFAC1VFtv2jAUfm5+xdkbLBeStGyFqBIF0qwSaiVKtU1ThZzgBHdOHNkG
Wk3773Mu0NDRiT30KBf7HJ/vfOeSmKYJgkedR5bQTkSREFh0IpYWCpTmHZbjTFmuhrfhI46k9YjW
yGKcJCeu7ZyatmvaXXCcvtvrd3uWvRVQatvWdF3/b/QdsOOCc9Yvrr+BBwMw3Z7xCXT1/AyDgQY5
in6iBIOCtyp4q4L3NNCApDnjEkr6K0modck5ehaepjctGWHWdSaHqzjG/LXfk5XiBUE1qhVMvH+b
Xf/O9Uqmztm5Iqk7Z1uuO/kIgxxxlEKEcgFyiWGBhSQZkoRlEDNe3CmSEBIpDvnxJETnl2tEKGyW
WAHwSgVEACrUKKS46djRzO06X4WURBCrcBTWjCzqYDMWTEYoRyGhRBIsWvvbkqsBIWMUo6zBoA2/
ttCa/q5BGgkpqbBJJmFeYXv7drEhMlq2Kpvy37cWEiGBIZiops2nwfCyX3ata7tF17r2qeHY+22r
pQiZUMw5XKi3ldAAS59zxltt78DpuFWFuLmd+9Pp7RQuLir3g5zK4nE8w0/XqZprd6yCxIgK7L10
sCklgZfTdayZ/212P/Xn7tgA26hrb0CC5VeykMtWu1x/wSRZymKjziyQRFf1uWI9e86xAdmKUpWV
fih0UYcFjkeMsm0psByxTOInBVpsgsmYo00xi9V+tGQCZ68moLSMcYxWVJZYqownB+sCb/L48aCe
pPiCFZEMb0rdS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