Question

I have a C++ program using openGL and it calculates the fps of my animation. However, I'm getting an average fps of 800 (which seems a little high). This is the code I'm putting in my display() function

int frames = 0;
int counter = 1;

display()
{
    //animation!

    //calculate fps
    if(TIME >= counter)
    {
            std::cout << "Frames at Second " << counter <<": " << frames << std::endl;
            frames = 0;
            counter++;
    }
    frames++;

}

Is my average of 800 fps okay, or is there a problem with my code?

Était-ce utile?

La solution

nope, its correct. You are rendering as fast as possible. If you want the typical 60 fps try putting on vsync

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top