Bug 911

Summary: Swing paint too late after switch from GLCanvas
Product: [JogAmp] Jogl Reporter: Karel Knoest <karelknoest>
Component: awtAssignee: Sven Gothel <sgothel>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: ---    
Version: 2   
Hardware: All   
OS: windows   
Type: --- SCM Refs:
Workaround: ---
Attachments: Modified TestAWTCardLayoutAnimatorStartStopBug532 to demo artifect
Runtime Version Check

Description Karel Knoest 2013-11-25 17:02:52 CET
Created attachment 557 [details]
Modified TestAWTCardLayoutAnimatorStartStopBug532 to demo artifect

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.

Few additional notes:
* If we replace heavyweight GLCanvas with lightweight GLJPanel, then this refresh problem doesn't occur.
* The problem occurs on Windows only, it seems.


Reproduction:
Attached a modified version of TestAWTCardLayoutAnimatorStartStopBug532. Each test goes from a JPanel with orange background, to GLCanvas, to a JPanel with blue background and again to GLCanvas.
When the blue Jpanel is shown, a brief flash of orange can be seen. 

----

Platform info: Short - see attached log for extended info.
OS: Windows 7, 64 bits
Java version: 1.7.0_45
Jogl: v2.1.2 tag
OpenGL: 3.3.0 (Quadro FX 1800/PCIe/SSE2)
Comment 1 Karel Knoest 2013-11-25 17:03:44 CET
Created attachment 558 [details]
Runtime Version Check
Comment 2 Karel Knoest 2013-11-27 12:06:27 CET
A tidbit of extra information: When replacing the lightweight JPanel with its heavyweight sibling Panel, the repaint problem does not occur.
Comment 3 Sven Gothel 2013-12-11 02:05:34 CET
I am afraid there is nothing we can do about this issue, i.e. heavy-/lightweight mixing issues.

As you state, either go heavyweight Panel .. or use GLJPanel.

Our other tests do not show anything special.

Maybe I find time testing your code in a bit.
Comment 4 Karel Knoest 2013-12-11 09:31:02 CET
Hi Sven,

Thank you for the reply. The light/heavyweight mixing is I'm sure indeed the root issue here. Strangely, if I replace the GLCanvas with a heavyweight java.awt.Canvas, the switch between heavy- and lightweight is without any refresh problems. 

Would you know of any aspect of GLCanvas that might cause the extra delay in refresh when compared to the heavyweight Canvas? We'd be happy to work around the problem if that's somehow possible.


For now, we reduced the problem to a brief white flash during GLCanvas > Lightweight switch by embedding our lightweight panels in heavyweight Panels.
Comment 5 Sven Gothel 2014-01-22 20:33:27 CET
See comment 3 - No more AWT lightweight/heavyweight hacking ..