🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

NeHe SDK and CPU usage

Started by
4 comments, last by GameDev.net 18 years, 4 months ago
Using main loop program similar (or equal) to standard NeHe SDK loop seems to cause serious overusage of CPU. According to Windows monitoring the program, even if it was just a normal Tetris - eats all the CPU power it can get. Normally I wouldn't bother, but with faster CPUs of today this results serious heat build-up. I tried to do some sort of hack to limit the programs CPU usage through capping the FPS: // get tick counts for timing and cap the FPS tp 60 while (currentTickCount-lastTickCount < 16) { currentTickCount = GetTickCount (); } ...but it naturally didn't help, as now the CPU doesn't do the program but the loop, still wasting CPU resources. Does anyone know a solid solution to do this properly??
Advertisement
Easy :

Sleep(20);

The process will be taken to sleep for 20 ms :) and will not eat your cpu.
Ofcourse, naturally! Thanks!
bad bad while(1) loops
if you are capping the fps inside your main loop with:
while (currentTickCount-lastTickCount <
mmm post didnt show up correctly ... change the while with an if and thats all. also there are better methods to cap the fps

This topic is closed to new replies.

Advertisement