Hey guys. Im just learning OpenGL and i just have a cude spinning with a texture mapped to it. But i wanted to go off and challenge myself by making an FPS counter. I wanted to have the FPS displayed on the screen but i dont want to have to make my own fonts then use texture mapped quads and such (If anyone knows an easier way to display text on the screen that would be great to).
Heres what i have so far:
int end = clock();
int start = clock();
...
...
...
...
TimeLastFrame = TimeThisFrame;
TimeThisFrame = (end-start)/CLK_TCK;
TimeLapsed += TimeThisFrame - TimeLastFrame;
secondslast = seconds;
seconds = TimeLapsed / 1000;
if( seconds != secondslast ) {
FPS = framecount;
}
framecount++;
....
...
....
...
if (keys[VK_F2])
{
keys[VK_F2]=FALSE;
sprintf( Message, "the Frame rate is: %i", FPS );
MessageBox( NULL, Message, "Current FPS", MB_OK );
}
And at the bottom i have it so whenever you prss F2 a message box pops up with the current FPS. But it ALWAYS says 0. So i dont know whats wrong. Any help is greatly appreciated..