Resize flickering with AWT GLCanvas and JOGL 2.4.0

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

Resize flickering with AWT GLCanvas and JOGL 2.4.0

Celine
Hi

I'm testing our 3D viewers with the new release version 2.4.0 on Windows 10 with OpenJDK 11 and I have an issue with the com.jogamp.opengl.awt.GLCanvas.
The canvas now flickers when resized and sometimes nothing is displayed. This issue is related to the background erase which doesn't seem to be properly disabled now.
It can be easily reproduced with the JOGLQuad example (https://jogamp.org/wiki/index.php/Rudimentary_standalone_example_using_the_fixed_pipeline_by_Julien_Gouesse) by removing the line "frame.setResizable(false);" and resizing the canvas.
If you remove the animator startup, you will see that sometimes nothing is displayed.



No issue with the com.jogamp.newt.awt.NewtCanvasAWT. I have not tested on Linux platforms yet.
Before filing a bug report, I wanted to know if the use of the property "sun.awt.noerasebackground" is now recommended.

For your information, you can see below the difference in calling the "disableBackgroundErase" method between 2.3.2 and 2.4.0



Thanks,
Regards
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

gouessej
Administrator
Hello

Why do you want to remove the animator?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

gouessej
Administrator
In reply to this post by Celine
I'm sorry for the dumb question but are you sure that you didn't have the problem in JOGL 2.3.2? Have you tested JOGL 2.3.2 with exactly the same version of Java? sun.awt.noerasebackground was efficient in the past; now it doesn't always work as expected as far as I remember. I'll try to reproduce your problem under Windows 11 and GNU Linux. Thank you for the reproducer.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

gouessej
Administrator
In reply to this post by Celine
Actually, I'm almost sure that it's not really a bug. When you don't use an animator, you have to call GLAutoDrawable.display().

Call GLAutoDrawable.display() when its container is ready to be displayed the very first time and use a ComponentListener to detect when the canvas is resized and call GLAutoDrawable.display()... or use an animator in order to let JOGL take care of calling GLAutoDrawable.display() for you. It depends on the level of control you need, both options make sense.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Celine
Forget about the animator, just lauch the example after removing the line "frame.setResizable(false);", you will see a flickering when canvas is resized. I did the test on the same machine with the same JDK just switching between JOGL 2.3.2 and 2.4.0.
I did a test on Ubuntu 20.04 with the same OpenJDK 11, the flickering occurs with both 2.3.2 and 2.4.0. So it seems that it's a regression only on Windows platform.
In all cases, setting the "sun.awt.noerasebackground" property solves this issue.
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

gouessej
Administrator
Thank you for your feedback. It's a good piece of news that sun.awt.noerasebackground still works, it's better than nothing. I'm going to give it a try under Mageia Linux with OpenJDK 17...
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Sven Gothel
Administrator
Thank you both.

If its worth a bug-entry, go ahead.

From the stack trace, yes we refactored - but seems like the same toolkit method is being called at roughly the same point. Right?

In case we have a 'success matrix' what goes and what not, we can 'hardcode' it ..
This would depend on the users as I prefer coding other things right now.

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Celine
Sven Gothel wrote
From the stack trace, yes we refactored - but seems like the same toolkit method is being called at roughly the same point. Right?
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.
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Celine
Hello

I did more tests especially with OpenJDK 17. In summary, GLCanvas background flickers when canvas is resized :
- 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
Setting the "sun.awt.noerasebackground" property to true solves this issue in all cases.

I filed a bug report with all the details here : https://jogamp.org/bugzilla/show_bug.cgi?id=1430.
Let me know if you need more information.

Thanks,
Regards
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Sven Gothel
Administrator
EXCELLENT! Thank you .. I will use your findings, i.e. rewinding the change I did 'back then' if possible/working.

Or do you like to do it and let me merge your git patches? (preferably)
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Celine
I understand that you would prefer me to try to fix it, but that's not planned at the moment and I guess it won't be soon as there is a simple workaround, sorry.
Reply | Threaded
Open this post in threaded view
|

Re: Resize flickering with AWT GLCanvas and JOGL 2.4.0

Sven Gothel
Administrator
OK, I will try to squeeze it in then.
Thank you for reporting your compatibility tests and analysis.