Repaint on switch from GLCanvas to Swing

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

Repaint on switch from GLCanvas to Swing

karelknoes
Dear all,

Our application switches between a GLCanvas to offer a 3D view and a several Swing JPanels to offer a various 2D views. For convenient switching, we use a CardLayout.

We experience a problem with the painting of the Swing views when switching from GLCanvas to Swing. Directly after the GLCanvas is interchanged for a Swing JPanel, the Swing JPanel shows a flash of garbage (one frame) before drawing its proper content. Crudely put, it seems Swing realizes too late that a repaint is required.

If we replace heavyweight GLCanvas with lightweight GLJPanel, then this refresh problem doesn't occur.

Looking forward to any thoughts that might help to find a solution.
Reply | Threaded
Open this post in threaded view
|

Re: Repaint on switch from GLCanvas to Swing

gouessej
Administrator
Maybe force the repaint of the JPanel just after the switch.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Repaint on switch from GLCanvas to Swing

karelknoes
Hi Gouessej,

Thanks for the feedback. An interesting direction we've also explored yet without success so far. Perhaps due to a combination of repaint synchronization between GLCanvas and Swing, and that Swing only considers repaints when the JPanel is visible.
Reply | Threaded
Open this post in threaded view
|

Re: Repaint on switch from GLCanvas to Swing

gouessej
Administrator
What happens when you put the GLCanvas into a JPanel instead of using it as is?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Repaint on switch from GLCanvas to Swing

karelknoes
Ah, sorry... my original description was perhaps a bit too concise. The GLCanvas is indeed part of a JPanel, which again is added to the CardLayout. The screen area underneath the GLCanvas is the part that is not properly refreshed.

The use of sun.awt.noerasebackground=true/false also doesn't make a difference.
Reply | Threaded
Open this post in threaded view
|

Re: Repaint on switch from GLCanvas to Swing

Sven Gothel
Administrator
On 11/22/2013 03:02 PM, karelknoes [via jogamp] wrote:
> Ah, sorry... my original description was perhaps a bit too concise. The
> GLCanvas is indeed part of a JPanel, which again is added to the CardLayout.
> The screen area underneath the GLCanvas is the part that is not properly
> refreshed.
>
> The use of sun.awt.noerasebackground=true/false also doesn't make a difference.
>

We have to unit tests using JTabbedPanel and CardLayout:

TestBug816JTabbedPanelVisibilityB849B878AWT
TestAWTCardLayoutAnimatorStartStopBug532

(find them in our JOGL source code repo)

Pls copy the closest one and renaming it,
while modifying it to produce the artifacts.

Pls also add information as detailed in Wiki/FAQ/Bugreport.

Pls add all this in a bugreport.

Thank you.

~Sven




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

Re: Repaint on switch from GLCanvas to Swing

karelknoes
Thank you for the pointer. I've modified "TestAWTCardLayoutAnimatorStartStopBug532" to show the artifacts.

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