NewtCanvasAWT does not appear in Java 11+

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

NewtCanvasAWT does not appear in Java 11+

hil23Ak
I have an application that integrates JOGL into Swing. It has been stable for years in Java 8/9/10. I am now trying to migrate to Java 11+ using JOGL 2.4.0.

After trying several vendors and versions of JDK, they all have the same behavior: my NewtCanvasAWT no longer appears.

It is added to the ContentPane of a JInternalFrame with:

newtCanvasAWT = new NewtCanvasAWT(glWindow);
final Container container = new Container();
container.setLayout(new BorderLayout());
container.add(newtCanvasAWT, BorderLayout.CENTER);
setContentPane(container);

Visually, it is as if the ContentPane is empty. In terms of processing, everything still works correctly. The call stacks get executed fully and OpenGL buffers are written to. This is confirmed by AWTGLReadBufferUtil.readPixelsToBufferedImage() still returning a rendered buffer.

Has something changed in Java 11 with how JOGL/NewtCanvasAWT/something interacts with Swing? Or maybe my method of adding to Container and ContentPane is no longer fully correct?

If anyone has any ideas, I would appreciate it. Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

gouessej
Administrator
Hello

Either provide a SSCCE or reproduce your bug with an existing test in our repository.

Do you have the same problem with GLJPanel?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

hil23Ak
I did more testing.

GLJPanel works.

Using a dummy java.awt.Canvas object with a background color does NOT work. This implies the issues is with java.awt.Canvas heavy weight component integration with Swing light weight system. I will look more into this.

I do not believe there is any issues with JOGL itself.
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

gouessej
Administrator
Which operating system do you use?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

hil23Ak
This is for a desktop application for Windows. I have only tested on Windows 10.

My current best theory is that it is an issue with mixing the heavyweight AWT Canvas with lightweight Swing components causing some sort of validation or z-layer issue. However, this does not explain why a regression occurred from Java 10 to Java 11+.
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

hil23Ak
I have found that "-Dsun.awt.disableMixing=true" will make the awt.Canvas's show. However, this is not a realistic solution because it disables the proper layering interaction between the Canvas surfaces with the rest of the Swing application.
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

gouessej
Administrator
Thank you for the feedback. Do you plan to report this bug against OpenJDK? Have you noticed a difference between OpenJDK 11.0.9 and OpenJDK 11.0.10?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasAWT does not appear in Java 11+

hil23Ak
After more investigation, I determined the issue was the result of 3rd party libraries putting translucent panes/components over the top of the Canvas. Why rendering behavior change from JDK 10 to 11, I do not know.

Ultimately this is a reminder that mixing heavyweight AWT into Swing is quite finicky (but is needed for high performance scenarios like 3d graphics).

Thanks for your help.