Reimplemented from OglGui::StaticText. Definition at line 35 of file FramesPerSecond.h. References OglGui::StaticText::DisplayFunc(), mFrameCount, mFramesPerSecond, mInitialized, mIntervalFrameCount, mLastInterval, mStartTime, and OglGui::StaticText::SetText(). 00036 { 00037 char buf[40]; 00038 float elapsedSec; 00039 00040 if (!mInitialized) 00041 { 00042 mInitialized = true; 00043 mFrameCount = mIntervalFrameCount = 0; 00044 mLastInterval = mStartTime = OglClock(); 00045 } 00046 00047 mFrameCount++; 00048 mIntervalFrameCount++; 00049 00050 elapsedSec = OglClock() - mLastInterval; 00051 00052 // Wait 3 tenth of a second after a reset before computing fps 00053 // This prevents too strong changes in fps at interval resets 00054 if (elapsedSec > 0.3f) 00055 mFramesPerSecond = mIntervalFrameCount / elapsedSec; 00056 00057 sprintf(buf,"%.1f fps", mFramesPerSecond); 00058 SetText(buf); 00059 00060 // To prevent misguided information when the display has been 00061 // interrupted reset every 5 seconds 00062 if (elapsedSec > 5) 00063 { 00064 elapsedSec = 0.0f; 00065 mIntervalFrameCount = 0; 00066 mLastInterval = OglClock(); 00067 } 00068 00069 StaticText::DisplayFunc(); 00070 }
Here is the call graph for this function:
|