Created attachment 856 [details] JOGLQuad example As mentioned in the javadoc of com.jogamp.opengl.awt.GLCanvas class, GLCanvas tries to disable background erase for the AWT Canvas. This works well : - on Windows with Java 11 and JOGL 2.3.2 but it does not work : - on Windows with Java 11 and JOGL 2.4.0 (regression) - on Ubuntu with Java 11 and JOGL 2.3.2 or 2.4.0 - on Windows and Ubuntu with Java 17 and JOGL 2.3.2 or 2.4.0 Tested on Windows 10 and Ubuntu 20.04 with OpenJDK 11.0.12+7 and OpenJDK 17.0.6+10. It can be reproduced with the attached JOGLQuad example, the background flickers when canvas is resized. Workaround: setting the "sun.awt.noerasebackground" property to true solves this issue in all cases.
Originally discussed here: https://forum.jogamp.org/Resize-flickering-with-AWT-GLCanvas-and-JOGL-2-4-0-td4042181.html
Celine posted in https://forum.jogamp.org/Resize-flickering-with-AWT-GLCanvas-and-JOGL-2-4-0-tp4042181p4042192.html Not really... With JOGL 2.3.2, the sun.awt.windows.WToolkit.disableBackgroundErase(Canvas) is called : @Override public void disableBackgroundErase(Canvas canvas) { WCanvasPeer peer = AWTAccessor.getComponentAccessor().getPeer(canvas); if (peer == null) { throw new IllegalStateException("Canvas must have a valid peer"); } peer.disableBackgroundErase(); } With JOGL 2.4.0, the sun.awt.SunToolkit.disableBackgroundErase(Component component) is called : public void disableBackgroundErase(Component component) { disableBackgroundEraseImpl(component); } private void disableBackgroundEraseImpl(Component component) { AWTAccessor.getComponentAccessor().setBackgroundEraseDisabled(component, true); } The regression on Windows platforms may be due to this change.
Commit 2e46eb1bf06ef07801062122716aa99a6c871646: Commit c5431f46b7bf64f109315ec78461859dd88f202a reduced the disableBackgroundErase(..) to SunToolkit's variation which doesn't work on Windows as it does not act upon the java.awt.Canvas peer post addNotify(). This re-introduces the java.awt.Canvas method via class JAWTUtil.BackgroundEraseControl and its called only after addNotify() on Windows and ASAP for everyone else. Method also calles the SunTookit variation just to be sure.