Hi,
I am trying to develop a Swing application using JOGL and I am not being able to get a decent performance. My machine is quite obsolete, Pentium III 600 with a GeForce 2 and latest NVidia drivers, but this machine is enough to run Quake 3 or Soldier of Fortune 2!! So I suppose my application should run lightning fast.
I tried the JGears demo, and it runs at a decent speed. So I am not sure if my problem I see is just when using other Swing widgets.
I am using Java 6 beta2. The problem is that I set the parameter in the startup “-Dsun.java2d.opengl=true” and the overall speed of the application doesn’t seem fluidic enough. If I try to click in one of the menus or move a scrollbar I see some delays in the response. From the perspective of the user this is terrible.
I created a custom scenegraph structure and placed all the elements in there (a camera, a lookat transform, some translates, a light and a cube and the floor grid), and in the GLEventListener I just loop through it and call draw(GL) for each object returned. Nothing else, no culling, no sorting.
A new iterator is created each time, and the indices of vertices and edges are stored in ConcurrentHashMap objects. The methods of this structure as implemented are O(1).
The first question is:
- in the current state of Swing and JOGL should it be “lightning fast” with the menus, buttons and scrollbars with instantaneous response? So the problem is most likely in my code.
- I am not an expert in Swing, is active rendering only valid for fullscreen modes?
- if the rendering of the GLJPanel is taking too long could I just “slow it down” to say 30fps? How?
- what would be the sanest way of measuring the fps in a application like this? I have code doing it when it’s fullscreen and I use active rendering, but not sure how to do it when using Swing.