#133 fgSetWindow causing CPU usage

nuisance (37)

Hello, I noticed higher CPU usage running freeglut-2.6.0 compared to old GLUT on older computers such as Win2k 1.4GHz Athlon with NVidia 6800 card. I'm running a simple spinning triangle demo with "Sleep(15)" in the idle callback for a nice frame rate. Old GLUT has zero CPU usage, whereas freeglut 2.6.0 has 20% CPU usage.

I downloaded the source code and traced the culprit to fgSetWindow() in freeglut_window.c. That function is called several times per display render, and it's doing an expensive ReleaseDC/GetDC every time. I inserted a simple "if" statement that skips the DC calls if fgStructure.CurrentWindow already equals window, and now freeglut's CPU usage is zero just like old GLUT. However, I don't understand freeglut's inner workings so I don't know if my simple change has broken other features.


  • John F. Fay

    John F. Fay - 2011-01-25
    • status: open --> closed-fixed
  • John F. Fay

    John F. Fay - 2011-01-25

    Fixed with changeset 888.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks