Framerate

How can i get current framerate of OpenGL program in SGI computer?..

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);

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.

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

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.