Skip to main content
gamedev.net
🔒 Locked

fps

Started by daniel_i_l 1 reply 950+ views
Original Post
daniel_i_l
daniel_i_l
I calculated my fps like this:

static Timer	t;

static float framesPerSecond    = 0.0f;                            
static float lastTime            = 0.0f;                         
                                
static float currentTime = t.getTime();                
static float printedFrames  =  0.0f;
    // Increase the frame counter
    ++framesPerSecond;

    if( currentTime - lastTime > 1.0f )
    {
// Here we set the lastTime to the currentTime.  
//This will be used as the starting point for the next second.
        lastTime = currentTime;

        // Reset the frames per second
        printedFrames = framesPerSecond;
        framesPerSecond = 0;
    }  

Then I printed the printedFrames. But for some weird reason, I got the same framerate (60) when I drew my whole map, and when I drew nothing at all? Thanks.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
gymisi
gymisi
Maybe, you use V-Sync, so you get same framerate...
Blog(Hungarian)MDX - C# - C++
Sr_Guapo
Sr_Guapo
Yes, make sure to disable v-sync in your code. Also, make sure that vsync is set to "application Dependant" (or whatever) in you driver properties.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.