Hello
I have a simple animation in 2D using OpenGL and when I run it, it takes almost 95% of the CPU. Why? How can I decrease this usage?
Regards
Hello
I have a simple animation in 2D using OpenGL and when I run it, it takes almost 95% of the CPU. Why? How can I decrease this usage?
Regards
Try limiting the rendering rate to say 30hz. To do this you will have to determine how long you spent rendering and then sleep for the remaining time in that particular frame. This will ofcourse free up your cpu but this may not be what you are wanting to do.
In most cases, I would imagine that your program is running a single animation loop and it attempts to run this continously as fast as it can. Which by the sounds of it is happening. This is great but if you want to decrease the cpu usage, you will have have it rest every once and a while, these sleep operations will do that for you.
Neil Witcomb
Something as simple as synchronising to the monitor refresh may help. If you are not doing this you may be rendering many times for each actual ‘draw’.
Joe
You can even tell your program to redraw only once every 3 monitor refreshes… in any case, the extension to use is WGL_EXT_swap_control
Originally posted by Morglum:
You can even tell your program to redraw only once every 3 monitor refreshes… in any case, the extension to use is WGL_EXT_swap_control
Hi
Can you send me or point me to an example which uses this mechanism?
Thanks