Thread: how to get fps in opengl

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    27

    how to get fps in opengl ?

    How do you get the frame rate in opengl/c++ ?
    Last edited by slx47; 05-10-2002 at 06:43 PM.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    ok heres the simplest way

    ~pseudo code!

    Code:
    // declare these where you need them
    
    // FPS stores last seconds fps
    // fcount is out current fps counter
    int FPS = 0, int fcount;
    // our timer for each second
    long timetest = 0;
    
    //later on...
    
    drawframe();
    fcount++;
    
    if(timetest == timer)
    {
        timetest = timer + 1 sec; // set timer  for next second
        FPS = fcount;  // set the FPS
        fcount = 0;    // clear the counter
    }
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    57
    GameTutorials has a tutorial on getting the FPS (in OGL). Exactly what yer lookin for .
    Language: C++
    Compiler: Visual C++ 6.0
    Currently Working On: Simple OpenGL aspects

  4. #4
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Whew i thought you meant "How to make first person shooter in OpenGL"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. Game update...
    By jdinger in forum Game Programming
    Replies: 14
    Last Post: 11-08-2002, 07:10 AM
  3. FPS Counter Prob in OpenGL
    By brandonp in forum Game Programming
    Replies: 1
    Last Post: 07-16-2002, 02:49 PM
  4. SkyLock graphics demo (scrolling, etc.)
    By jdinger in forum Game Programming
    Replies: 9
    Last Post: 06-30-2002, 08:18 PM
  5. Displaying FPS in openGL...
    By Jackmar in forum Game Programming
    Replies: 1
    Last Post: 05-22-2002, 07:40 PM