Bug 911 - Swing paint too late after switch from GLCanvas
Summary: Swing paint too late after switch from GLCanvas
Status: RESOLVED WONTFIX
Alias: None
Product: Jogl
Classification: JogAmp
Component: awt (show other bugs)
Version: 2
Hardware: All windows
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2013-11-25 17:02 CET by Karel Knoest
Modified: 2014-01-22 20:33 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments
Modified TestAWTCardLayoutAnimatorStartStopBug532 to demo artifect (8.87 KB, text/x-java-source)
2013-11-25 17:02 CET, Karel Knoest
Details
Runtime Version Check (139.44 KB, text/plain)
2013-11-25 17:03 CET, Karel Knoest
Details

Note You need to log in before you can comment on or make changes to this bug.
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 ..