• Welcome to Dark Bit Factory & Gravity.
 

fps..

Started by marlon, April 25, 2012

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

marlon

Hello all you mighty coders in here!  =)


FPS.. Not "First Person Shooter"
but frames per second..  hehe

My problem is that when I have coded something I have different results of speed on my cousins pc and on my own..
My pc shows a very fluid motion in the rotation of my 3d.. But on my cousins pc in the other hand it is the same fluid motion but it takes ages for the rotation to switch to opposite rotation.. How can I rotate it, so it will rotate in the speed and maybe skip some frames instead??

http://www.marlonbodhi.com/GPUjello.rar

It is the Grid/Heightmap that makes the worst problems..


- Marlon Bodhi

Kirl

#1
Instead of frames per second you can use elapsed time times the rotation speed, I believe it's called delta timing. :)

Basically you use the time to calculate how many frames should have been displayed since the last frame, and you just multipy the speed by that amount.
www.kirl.nl
Challenge Trophies Won:

marlon

would it be possible to aim for a certain fps rate (maybe 60) and then discard all frames above?

Raizor

Yes, I've done something like that before. It's probably better to use delta timing, but the method you mention works.

When I did it, I rendered a frame and then looped until the frame time was 16 ms (milliseconds). As there are 1000 ms in a second, 60 fps equals 16 ms per frame. My loop was just a simple loop that got the elapsed time in the current frame and keep repeating until elapsed time was equal to or greater than 16 ms.

Something like this:

* Render frame
* Check time taken to render frame
* If frame time > or = 16 ms then render next frame
* If frame time < 16 ms, wait until we've hit 16 ms and then render next frame.
raizor

Challenge Trophies Won:

Kirl

There's a good article on delta timing here, in case you decide to use it. :)
www.kirl.nl
Challenge Trophies Won:

Watt–Wilton

One of my friend have faced the same problem and he did the same thing  as If frame time < 16 ms, wait until we've hit 16 ms and then render next frame.