-
Fps counter using OpenGL?
How do i make a simple Frames per second counter using OpenGL for Visual c++ 6.0???
an example would be much appreciated.
-
Senior Member
OpenGL Guru
Re: Fps counter using OpenGL?
You can't make a frame rate counter with OpenGL, cause OpenGL doesn't provide any timer functions. Use some system timers instead, like timeGetTime or QueryPerformanceCounter. Look in MSDN for more details on how to use them.
There's a few ways to calculate the FPS, all based on the same formula. FPS = frames / time, where frames is the number of frames rendered, and time is the time taken to render them. For example, measure the time taken to render one or ten (or as many as you like) frames, or count the number of frames rendered in a second.
-
Member
Regular Contributor
Re: Fps counter using OpenGL?
Hi,
Check on my site, I've a little example who use a fps counter.
http://ibelgique.ifrance.com/Slug-Production/
-
Re: Fps counter using OpenGL?
go to http://www.gametutorials.com they have good tutorails for opengl and one ids the fps counter check it out
-
Re: Fps counter using OpenGL?
-
Re: Fps counter using OpenGL?
Thanks for all your replies
-
Re: Fps counter using OpenGL?
If you use Glut libraires it's very easy, you have to take the time with the function "glutGet (GLUT_ELAPSED_TIME)" and make a substraction with the previous value:
time = glutGet(GLUT_ELAPSED_TIME);
if ((time - base_time) > 1000.0)
{
fps=frames*1000.0/(time - base_time);
base_time = time;
frames=0;
}
The variable "frames" is a counter of frames, and It's to be incremented in each frame (Usually in Draw function).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules