Results 1 to 2 of 2

Thread: help with frames per second

  1. #1
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    201

    help with frames per second

    I am having trouble calculating my frames per second. I have a function that computes it but I know its wrong because its always less than 1 and there is no way thats right because I can move my object around and it doesnt even flicker.

    here is my function what am I doing wrong

    void calc_fps()
    {
    char fps[20] = {0};
    float time,cur_time;
    float total;
    static float prev_time = 0.0;


    time=glutGet(GLUT_ELAPSED_TIME);

    cur_time=time-prev_time;

    prev_time=time;

    total = cur_time/1000.0;sprintf(fps,"FPS:%f", total);


    }

  2. #2
    Member Contributor
    Join Date
    Apr 2002
    Posts
    94

    Re: help with frames per second

    I think your function will calculate seconds per frame instead of frames per second. I think you need to take 60.0f and divide by your calculation.
    P4 2Ghz, GEFORCE4, 512 Meg RAM, WIN2000, VStudio 6.0

Similar Threads

  1. Frames Per Second??
    By in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 01-28-2004, 03:29 AM
  2. help with frames per second
    By mdog1234 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-06-2002, 01:26 PM
  3. Frames per second
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-29-2002, 11:06 AM
  4. Frames Per Second
    By smiley in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-28-2002, 07:05 AM
  5. frames ???
    By Blza in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-26-2000, 07:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean