Sign in to follow this  
h4tt3n

freeglut consuming huge amount of cpu power?

Recommended Posts

Hello, Lately I've been experimenting a lot with glut and the newer (but also abandoned?) freeglut. I was quite disappointet to see that freeglut seems to spend (waste) a lot more cpu power than it's much older predecessor glut. To illustrate my point I've uploaded two identical code::blocks physics sandbox projects, one running glut the other running freeglut. They appear to run equally stable, but glut only uses about 5 % cpu power (as shown in the joblist) whereas freeglut seems to need around 50% cpu power - 10 times as much - to run the same application. Could anyone explain why this is so, or maybe how to "tune" or otherwise change freeglut, so it doesn't consume unnesecarily huge amounts of cpu power? glut example freeglut example Thanks in advance! Cheers, Mike [Edited by - h4tt3n on March 16, 2009 1:17:56 PM]

Share this post


Link to post
Share on other sites
It sucks a bit to say but I see the same problem with SDL (it's about 40% overhead).
Personally I have noticed alot of people went crazy with performance lately.

Just to let you know I share your feelings about that.

Share this post


Link to post
Share on other sites
Quote:
two identical code::blocks physics sandbox projects, one running glut the other running freeglut. They appear to run equally stable,

This is not what I found. Is the code the same for both demos (I have not done a diff on them)? I ask because the freeglut version bounces correctly where as the glut version does not.
Freeglut is not abandoned in fact the last svn commit was a little over an hour ago.
Quote:
but glut only uses about 5 % cpu power (as shown in the joblist) whereas freeglut seems to need around 50% cpu power

What is "joblist"? Is this a profiler of some sort?

Quote:
Could anyone explain why this is so, or maybe how to "tune" or otherwise change freeglut, so it doesn't consume unnesecarily huge amounts of cpu power?

Sure here is a quick fix that only involves one function. Sleep!!
Seriously it is running in a constant loop how much "power"/cpu usage do you expect it to take?

Share this post


Link to post
Share on other sites
Quote:
Original post by CmpDev
I ask because the freeglut version bounces correctly where as the glut version does not.

I'm not entirely sure what you mean by "bounce" here. English is not my primary lingo.
Quote:

Freeglut is not abandoned in fact the last svn commit was a little over an hour ago.

Cool, I didn't know. It's just that the latest official stable release (2.4.0) from the freeglut website is a few years old by now.
Quote:

What is "joblist"? Is this a profiler of some sort?

That's probably a translational error from my side, sorry. I mean the job list as in what you get (in windows) when you press ctrl + alt + del twice. What's it called in english again?
Quote:

Sure here is a quick fix that only involves one function. Sleep!! Seriously it is running in a constant loop how much "power"/cpu usage do you expect it to take?

Well, honestly I expected the freeglut version of glutMainLoop() to contain a functionality that automatically frees the highest possible amount of cpu time for the OS without getting a performance loss in the running freeglut application. You know, just like the old glut apparently does :-)

Would I really have to add a sleep command to the glutMainLoop() source and recompile it in order to reduce cpu useage?

Cheers,
Mike

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this