FPS Counting

Hey everyone, i am a total begginer in OpenGL. Is there a way i can view the fps? can someone tell me some basic code?


static unsigned long start_time = 0;
static unsigned long end_taken = 0;
static int FPS = 0;

//start loop

start_time = GetTickCount();
// do your fancy code here

end_time = GetTickCount();
FPS = 1000/(end_time - start_time);

//end loop

GetTickCount() works with resolution of 1/1000th second under win32. I think GetTickCount() is accurate to < 10ms on most win OS’s.

[This message has been edited by dans (edited 05-03-2001).]

Often you only need to search: three identical questions in 2 days!!
Here they are:
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/003963.html http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/003951.html