Skip to main content
gamedev.net
🔒 Locked

CPU 100 - performance question

Started by Decrius 7 replies 850+ views
Original Post
Decrius
Decrius
Hi, I have an GLFW project, on my Windows XP machine, and it works fine on my own pc, but on my sisters old crappy laptop its cpu 100. I display 9 by 9 quads with textures of 64x64, in the middle the character (ortho projection), which, which I load with freeImage and bind them in the scene (bind everytime, even if the last one was the same texture as it needs at the current time, because thats with less if and elses, but maybe I should not bind the same texture? if that makes a bigger performance...). every scene I draw everything again, even if nothing changed (should I not update it? does that makes bigger performance? not if they move, than it will still need to refresh). Everytime the character moves, the quads are redrawn with the new positions, I do not use gltranslate, would it be better to do use gltranslate? Thanks you, Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
mrbastard
mrbastard
A common 'problem' (may not be a problem at all) and not related to OpenGL. See this
and the rest of these

hope that helps
[size="1"]
Decrius
Decrius
That means I _have_ to use the sleep function?

Thanks,

Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
lancekt
lancekt
You don't have to. But it's certainly good to play nice with the other applications on the system and give them some CPU time too. :)
Orin Tresnjak | Graphics ProgrammerBethesda Game StudiosStandard Disclaimer: My posts represent my opinions and not those of Bethesda/Zenimax, etc.
mrbastard
mrbastard
The OS will give other apps cpu time anyway, but will have to share this finite resource among fewer processes while your app is sleeping.

Given that a game is usually fullscreen and taking all of the user's attention, 100% cpu usage isn't unreasonable.

EDIT: there are situations where your app could be running but not the main focus of the users attention - for instance when it's minimised or the user has alt-tabbed away from it. In those cases, it's polite to ensure your app isn't taking up enough resource to slow down other apps.
[size="1"]
Decrius
Decrius
Okay thanks,

Its not a full screen game, just in a window (big window). The function I use now is glfwSleep(double time);. Build in glfw, where I can only give a double as time. 0.01 is nice, but than on the crappy laptop its still laggy. And 0.02 gets laggy on my own pc too (waits too long). Is the laptop just too bad? Or my program? The laptop has a intel cerelon 2,5 GHz

Thanks,

Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
Decrius
Decrius
Maybe it has to do with the processor?

Im using AMD Athlon 64 2800+ (compiling at it), laptop is Intel celeron 2.5GHz and the other pc is using a AMD Athlon something. The laptop and other pc have cpu 100 while I have cpu 0. 2 of my friend have cpu 0 too, where one of them had a AMD Athlon 3400+.

Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
Richy2k
Richy2k
If you vsync, it'll free up CPU time. If this is forced off in your driver settings you'll run at 100% CPU unless you sleep. If its forced on, it will wait, and can sit low or high CPU usage, depending on how long it takes to render one frame. If its upto the app, its up to your app to turn it on or off. I personally force it off so I can roughly gauge performance, and I will worry about high CPU usage when running multiple threads, but I sleep/yield if I need to.
Decrius
Decrius
Okay, thanks.

Would it be, anyways, better to use Lists?

I draw 81 tiles of 64x64 with different textures. Each time I draw a tile (with my function), I give it the x an y possitions and width and height. So the quad I draw is each time different (different x, y, w, h values), and I draw it each frame...81 tiles per frame...

Is it better to use lists or not? Because the values change each time, or I should use gltranslate for each tile, so the x and y values are set in gltranlate, so the values of the quad will be the same each time...

Decrius
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.