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't be displayed in the first place. Some relevant discussion in the forum: http://forum.jogamp.org/Clearing-NewtCanvasAWT-td4026943.html
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.
In case it is useful, I'm attaching a patch with the changes I mentioned earlier.
Created attachment 409 [details] Clears the FBO texture
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.
Created attachment 410 [details] Patch that adds a default color field to GLCapabilities
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'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 'clear'
This aggregated build is pretty recent: http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936-jocl_761/ .. but doesn't contain the mentioned unit test tweak to disable animation.
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) > This aggregated build is pretty recent: > > http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936- > jocl_761/ > > .. but doesn't contain the mentioned unit test tweak to disable animation.
(In reply to comment #8) > 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) > > This aggregated build is pretty recent: > > > > http://jogamp.org/deployment/archive/master/gluegen_652-joal_413-jogl_936- > > jocl_761/ > > > > .. but doesn'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 'once and for all' - 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
Note: Clearing framebuffer of newly created GLFBODrawable instances using the current clear color is now implemented due to workaround Bug 1020.