Login | Register

Home > Forums > OpenGL > Graphics Applications using 100% CPU Usage Page :  1 
Graphics Applications using 100% CPU Usage

I have received the following e-mail and have placed the answer in the forums as I feel it is relevant to most visitors of the website.

"I'm studying your openGL examples: they are very clear and very interesting, and I like to use your glutils as base for my little opensource project.

However, compared glut based application with your examples (and nehe
too) I've seen a great, important difference!!
The CPU usage using GLUT is almost 0, while in tutorial applications is always 100%

I'm a newbie, so it's hard for me, but I'm sure for you it's a joke to insert a timer/sleep function to have the same CPU as glut.
Can you suggest me how to modify the code, in example, of your lesson 03?"

The reason that you are experiencing 100% CPU usage is that a new frame is constantly being rendered. GLUT does not render a new frame until you make a call to glutPostRedisplay. If you run one of the tutorials that do not use this function, you will notice that the CPU is not used greatly.

You will notice that any tutorial that has animation (tutorial 10 onwards), will take up as much CPU time as possible. This is because you are trying to render as many frames as possible every second.

The reason why the base code does not take the same approach to GLUT is that most graphical applications or demos will usually have some form of animation. If you are creating an application that does not need a new frame to be rendered often, you can easily modify this in the base code.

Please let me know if you have any questions.


Home > Forums > OpenGL > Graphics Applications using 100% CPU Usage Page :  1 

You need to be logged in to reply to this topic.

All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005

Read the Disclaimer