Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: FPS counter

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Florence, Italy
    Posts
    219

    FPS counter

    How do I build one ?

  2. #2
    Intern Contributor
    Join Date
    Aug 2000
    Location
    USA
    Posts
    99

    Re: FPS counter

    FPS = frames per second = number of frames divided by total seconds elapsed time. And there you have it.

  3. #3
    Guest

    Re: FPS counter

    Look for QueryPerformanceCounter() if you're
    on windows, setitimer() if you're on linux,
    or system_time() if you're on BeOS.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Almazora, Spain
    Posts
    104

    Re: FPS counter

    I use thw windows API function GetTickCount(), that returns the number of miliseconds passed since you started Windows (since you started Windows or your application, I'm not sure). You can play with this function to retrieve the time from one frame to another.
    MeTaL WiLL NeVeR DiE!!!!!

  5. #5
    Guest

    Re: FPS counter

    The problem with GetTickCount() is that it's
    only millisecond accurate. If you're
    running at 100 fps (a good goal :-) then
    there's only 10 ticks per frame, so your
    precision quantization will be a full 10%
    of your counter!

    QueryPerformanceCounter() typically gives you
    about microsecond resolution, and the
    precision loss from using the counter drops
    to 0.01% or less -- definitely down in the
    noise.

    If you're targeting pentium-class or higher
    CPUs, QueryPerformanceCounter() is always
    available, so it's usually the best way to
    go. (Myself, I decided that MMX is a
    requirement, which guarantees performance
    counters, too)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •