in C ++, my favorite timer is what Steve offers.
there may also be a problem of disabling vsync in your opengl application, for me it has always been turned on by default, and you need to download some functions to disable it.
as for a more platform-independent solution,
use time .h
:( , , , , , fps ( GetTime())
static int lastTime = GetTime();
static int framesDone = 0;
int currentTime = GetTime();
if(currentTime > lastTime)
{
int fps = framesDone;
framesDone = 0;
lastTime = currentTime;
}
framesDone++;
, .
vsync, .