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
Instead of frames per second you can use elapsed time times the rotation speed, I believe it's called delta timing (http://en.wikipedia.org/wiki/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.
would it be possible to aim for a certain fps rate (maybe 60) and then discard all frames above?
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.
There's a good article on delta timing here (http://www.scirra.com/tutorials/67/delta-time-and-framerate-independence/page-1), in case you decide to use it. :)
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.