decrease CPU load NEED help

Hi all,

I try to make a OpenGL framework with JOGL. At this moment everything goes well.
When i check the CPU load, while JOGL is running, I always got 100% of CPU load. When i minimize the application, JOGL still eat 99 % of my CPU. :’(

My questions is:
1 : How can i reduce the CPU load when the application lost the focus
2 : Why do JOGL consume 100% of CPU power when its only draw one single rectangle.

All help are welcome.

thanks in advance.

evl_one

  1. You can, for example, use a FocusListener to receive focus events. While the application isn’t focused, run a small Thread.sleep(100) or similar in the main loop.

  2. If you’re not limiting the framerate in any way, jogl will try to get as high framerate as possible. Unless your bottleneck is the gpu (very unlikely with just one rectangle), you’ll end up using 100% of the cpu. Note that for most (full screen) games, this is actually what the users WANT. They want the game to use their entire cpu, and provide as much framerate as possible.

Thank I will try it…

Also depending on your application’s structure you may not need to use e.g. an Animator. The InfiniteShadowVolumes demo and others, for example, redraw only on demand, which is the default behavior you’ll get if you simply don’t hook up an Animator.