how to reduce CPU usage while Animator is running

  3 posts   Feedicon  
Replies: 2 - Last Post: February 07, 2010 06:14
by: rhdxmr
showing 1 - 3 of 3
 
Posted: February 06, 2010 16:49 by rhdxmr

Hi, all JOGL users Smile

I felt that the same JOGL program running in the MS windows is much faster than
in the Linux.

But soon, I realize that in MS windows the java process consumes all CPU usage(99%)
when JOGL program uses Animator.


What will make the program reduce the CPU usage?

And How can I set the speed of Animator, which is independent of platform or
performance of machines?


Thanks.
 
Posted: February 06, 2010 17:33 by Michael Bien
hi rhdxmr,

what you want is to limit the FPS. The easiest (and smoothest) way of doing this is by enabling vsync.

This will tell the driver to limit the FPS to the screen refresh rate. (put it somewhere in the init() method)
gl.glSetSwapInterval(1); // 1 == true

however some drivers allow to override this via driver settings and you can't do anything about that in your app.
 
Posted: February 07, 2010 06:14 by rhdxmr
Unfortunately, as you said, setSwapInterval() seems not to work in my machine.
But there exists the alternative, FPSAnimator class.
So far it looks fine unless I need an accurate FPS.
Replies: 2 - Last Post: February 07, 2010 06:14
by: rhdxmr
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close