PDA

View Full Version : Framerate



mcrn
05-24-2000, 08:15 AM
How can i get current framerate of OpenGL program in SGI computer?...

Glenn Upton
05-24-2000, 08:14 PM
Here is the code I use.

// Updates frame rate every 5 seconds
case WM_TIMER:
{
int nFrames;
char cOutBuffer[32];
LARGE_INTEGER currentTime; float fps;
// Get the frame count
EnterCriticalSection(&csThreadSafe);
nFrames = rsRenderData.uiFrames;
LeaveCriticalSection(&csThreadSafe);

// Get the current Time
QueryPerformanceCounter(&currentTime);

fps = (float)(nFrames - nLastFrames)/((float)(currentTime.QuadPart - startTime.QuadPart)/
(float)timerFrequency.QuadPart);
sprintf(cOutBuffer,"fps %0.1f ",fps);

Bob
05-25-2000, 12:56 AM
The above code is for Win32 platforms, and will most certainly not work on SGI computers. But the way to calculate it is still the same. Either calculate the time for any number of frame, or count the number of frames in any given time. fps=<number of frames>/<time in seconds> in both cases.

Can't post any code since I'm no UNIX programmer.

john
05-25-2000, 04:25 PM
Check out the thread:
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/000472.html

it tells you what man pages to look at to get timing info. (If you need more help, let me know...)

cheers,
John

nickels
05-27-2000, 07:18 AM
You can get nanosecond resolution on SGI's with (I beleive) clock_gettime(SGI_REALTIME_CLOCK).

I am not 100% sure this is the name, but it is close.