Author Topic: fps..  (Read 5344 times)

0 Members and 1 Guest are viewing this topic.

Offline marlon

  • C= 64
  • **
  • Posts: 38
  • Karma: 15
    • View Profile
fps..
« on: April 25, 2012 »
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

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: fps..
« Reply #1 on: April 25, 2012 »
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.
« Last Edit: April 25, 2012 by Kirl »
www.kirl.nl
Challenge Trophies Won:

Offline marlon

  • C= 64
  • **
  • Posts: 38
  • Karma: 15
    • View Profile
Re: fps..
« Reply #2 on: April 25, 2012 »
would it be possible to aim for a certain fps rate (maybe 60) and then discard all frames above?

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: fps..
« Reply #3 on: April 25, 2012 »
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:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: fps..
« Reply #4 on: April 25, 2012 »
There's a good article on delta timing here, in case you decide to use it. :)
www.kirl.nl
Challenge Trophies Won:

Watt–Wilton

  • Guest
Re: fps..
« Reply #5 on: October 02, 2013 »
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.