Hello all,
I’m keen on using Swing components, including GLJPanels. I’m seeing a bigger performance hit than I expected though on my simple demo (a texture mapped Earth):
GLCanvas: 90fps
GLJPanel: 13fps
Profiling the GLJPanel confirms that large chunks of CPU time are being eaten by:
sun.java2d.loops.Blit.Blit: (33.38%)
net.java.games.jogl.impl.x11.X11GLImpl.glReadPixels: 16.06%
(The percentages are not accurate; they should be multiplied by about 1.5 since my retarded profiler counts cycles in waitForEvents.)
I have two questions:
-
It’s surprising to me that I’m losing so much performance. Is there anything I should check for?
-
Sun is doing a lot of work to accelerate Swing components using OpenGL (enabled with -Dsun.java2d.opengl=True). I believe they are using a pbuffer to back Swing components and letting the videocard blit them. It seems like there could be a wonderful intersection between GLJPanel and Sun’s OpenGL implementation: if only they could play together nicely, perhaps the extra copies would become unnecessary…
At the moment, JOGL apps and -Dsun.java2d.opengl=True do not seem to like each other at all; I almost immediately get “Xlib: unexpected async reply (sequence 0x304)” after starting the app, and no graphical output.
On a related subject: I’ve noticed that the backing pbuffers of an GLJPanel never seem to shrink after having been enlarged. This is somewhat unfortunate for performance if the user temporarily enlarges a window.