Swing components above OpenGL window dont update.

hello,
i am mixing swing and jogl and i have problems with swing-dialog boxes that pop up above the opengl area. these elements dont show up their subelements. they only show a grey rectangle, the size of the component, but nothing inside. if i start resizing then the contents appear.

this is winXP, java 1.5, jogl 1.0.0

thanks for any help!

Did you specify -Dsun.java2d.noddraw=true ?

yes i did!

could it be that i use the heavyweight GLCanvas in conjunction with Swing.

i tried GLJpanel instead, and now the swing components partially appear after a few seconds, but the framerate goes down towards 1 FPS.

If the Swing components are showing up in another top-level component then there shouldn’t be any interference between the heavyweight GLCanvas and them.

Do you have an Animator attached to your GLCanvas? Have you tried temporarily turning it off to see if that changes things?

Have you tried JDK 6 with the GLJPanel and -Dsun.java2d.opengl=true to see whether the Java2D/JOGL bridge helps with the performance problems?

What graphics card do you have?

Do you have a small test case showing the problem?

I’ve noticed similar issues in my application. I tried tracking down the cause of this and as far as I could tell this was (at least partially) due to the prioritizing of events in java.awt.EventQueue. You’ll see there that heavyweight paint events get the lowest possible priority. My hunch was that when a new popup menu or tooltip (using heavyweights for both) triggered some event that got low priority and due to my opengl view hogging the EDT, that these events didn’t get much chance to actually be processed. After optimizing my rendering code, the delay for the popups and tooltips to actually draw improved considerably. This also seems to point in the direction that some event isn’t being processed in a timely fashion.
I don’t have exact knowledge of how all the different parts (native side, java side, popup menus, …) in awt interact though, so I might have drawn a wrong conclusion. Hopefully one of the awt engineers can shed some light on this?

thanks guys.

yes, turning of the animator did solve the problem. unfortunately the opengl canvas does not redraw anymore.

i have not tried it with java 6 yet.

this problem appears the same on all graphics cards we have tried. these are all mid-level ATIs and NVIDIAs.

as for a testcase, i’ll see what i can do.

I think these issues are due to starving the AWT Event Dispatch Thread as pepijnve suggests. I’ve seen similar issues in particular on X11 platforms where the synchronization related to graphics is slightly different than on the Windows platform. I’d suggest you try using the FPSAnimator to throttle back the number of frames per second of your application, at least when dialog boxes are obscuring it. Also, if your application doesn’t actually animate, but only redraws in response to user input, consider just calling repaint() / display() as needed on your GLCanvas and not using an Animator at all.

thanks!

ok, when i use the FPSAnimator, then frames like a fileopendialog pop up correctly and instantly on top of the GL area. however other components like the menubar open below the GL area. i can see the top two entries of the menubar, but the rest goes behind the opengl canvas.

You can fix this by forcing swing to use heavyweight components for popups, menus and tooltips as follows:

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

ok, using this in combination with a slow FPSAnimator (<30FPS) fixes the problem.

Thank you!