Clearing NewtCanvasAWT

classic Classic list List threaded Threaded
6 messages Options
ac
Reply | Threaded
Open this post in threaded view
|

Clearing NewtCanvasAWT

ac
I'm experiencing a minor issue. When I initialize my drawing surface using NewtCanvasAWT, the window momentarily shows garbage from the framebuffer, something like this:

http://snag.gy/v8JZZ.jpg

This happens when I add the NewtCanvasAWT to the parent component (in my case an Applet), and will show up until the animator loop kicks in and glClear() is called for the first time.

Even if I call canvas.setBackground(Color.GRAY) before adding the NEWT canvas to the parent, I still see the garbage. If the application does some time-consuming initialization before clearing the first frame, the garbage frame could be seen for a relatively long time. Is there any way to make sure that the NewtCanvasAWT is clean before attaching it to the parent? This didn't happen with AWT's GLCanvas, BTW.
ac
Reply | Threaded
Open this post in threaded view
|

Re: Clearing NewtCanvasAWT

ac
It seems that it is platform specific: right after the frame.add(canvasNEWT, BorderLayout.CENTER) call, the output window appears black on Windows, until the first frame is finished and the buffers are swapped. But on OSX, the window will show some garbage left in the framebuffer, which is cleared only at the end of the first frame.
Reply | Threaded
Open this post in threaded view
|

Re: Clearing NewtCanvasAWT

Sven Gothel
Administrator
On 11/27/2012 08:59 PM, ac [via jogamp] wrote:
> It seems that it is platform specific: right after the frame.add(canvasNEWT,
> BorderLayout.CENTER) call, the output window appears black on Windows, until
> the first frame is finished and the buffers are swapped. But on OSX, the
> window will show some garbage left in the framebuffer, which is cleared only
> at the end of the first frame.
>

Right - we don't clear the FBO content at creation.

You think we shall do that ?

Maybe in GLFBODrawableImpl, or in FBObject directly ?
And then .. in which color ? Default black '0' ?

~Sven


signature.asc (909 bytes) Download Attachment
ac
Reply | Threaded
Open this post in threaded view
|

Re: Clearing NewtCanvasAWT

ac
> You think we shall do that ?

Yes, I think the FBO should be cleared, as the framebuffer garbage shows up for a while and doesn't look good, specially when sketches start-up in Processing.

I tried a couple of things to clean it manually... for example calling glClear() the first time the listener's display() method is triggered, but didn't make a difference.

> Maybe in GLFBODrawableImpl, or in FBObject directly ?

I noticed that the garbage appears immediately after frame.add(canvas), which is before any of the drawables or FBObjects are created, if I'm not mistaken. So not sure where the clean-up should happen...

> And then .. in which color ? Default black '0' ?

Black is better than nothing, and is what happens on Windows and Linux anyways. Having the option to set a default color would be great though because then I can make it match the default background color in Processing... but this is not a necessity and adding new API for a single user is probably not a good idea.
ac
Reply | Threaded
Open this post in threaded view
|

Re: Clearing NewtCanvasAWT

ac
I added a enhancement request for this one:

https://jogamp.org/bugzilla/show_bug.cgi?id=649

Thanks.
ac
Reply | Threaded
Open this post in threaded view
|

Re: Clearing NewtCanvasAWT

ac
I uploaded some patches that could be useful to properly take care of surface initialization. See bug mentioned earlier.