I've been doing more (possibily unhelpful) experimentations. I've noticed that my sketches (with any renderer: java2d, p3d, opengl) -will- use more than 50% of CPU if pushed very hard.
For example, if I do a draw() loop that draws 1000 ellipses in random locations:
for (int i=0; i<1000; i++) {
ellipse(random(0,width), random(0,height), 55, 55);
}
I get the following behaviour in each renderer:
JAVA2D [javaw.exe cpu:95%] [fps:14]
P3D [javaw.exe cpu:95%] [fps:6]
OPENGL [java.exe cpu:65%] [fps:20]
OpenGL is by far the smoothest. Even though it's frame rate is low, it's high compared to the others. But why is it only using 65% of the CPU? Wouldn't it have been even smoother if it used more CPU? I think that's the question people in this thread are wondering about. If I increase the number of ellipses drawn each loop to 2000, I get:
OPENGL [java.exe cpu:80%] [fps:12]
As that shows, the only way to get it to use more CPU was to make it do more work, which in turn dropped the frame rate, and made it LESS smooth in the end.
If I lower the number of ellipses drawn to 500 per loop, and test with OpenGL again, I get the following:
OPENGL [java.exe cpu:49%] [fps:34]
Yep, it's faster drawing only 500 ellipses, the frame rate increased to 34fps, but now the CPU is only at 49%! What about the 50% idle? It's not being used at all..
..and here's the real kicker from my other thread. With that last 500 ellipse/opengl example running, I open firefox/ie and go to a page that uses the Flash plugin.
OPENGL [java.exe cpu:80%] [fps:48]
Even JAVA2D/P3D applications see a similiar jump. While this is not as big a jump as I've seen, it's a jump nonetheless. What is Flash (and other applications) doing that affect how Processing applications perform? Are they tripping some switch somewhere, in memory, on the videocard? An additional factor that revealed itself is that this weird jump in CPU usage/performance only takes affect when the applet's window is focused. If i click back on forth on the titlebars of the applet and task manager (which is set to always be on top) the java.exe CPU jumps to 80% when the applet is focused and drops back to 49% when the task manager is focused.
Unfortunately, it's a ridiculously complicated thing to try to explain, whereas it only takes a few seconds to demonstrate in practice..
Tim