A bug with how fps is calculated can produce NAN which means ofGetFrameRate will always return NAN. So far I have only seen this on Win32 machines but the code is incorrect as it has a division by zero.
The fix is in ofAppGlutWindow.cpp:
The code bellow should be changed from:
// -------------- fps calculation:
timeNow = ofGetElapsedTimef();
if( (timeNow-timeThen) > 0.05f || nFramesForFPS == 0 ) {
fps = (double)nFramesForFPS / (timeNow-timeThen);
timeThen = timeNow;
nFramesForFPS = 0;
//hack for windows - was getting NAN - maybe unitialized vars???
if( nFrameCount < 5) frameRate = fps;
else frameRate = 0.9f * frameRate + 0.1f * fps;
}
nFramesForFPS++;
// --------------
to:
// -------------- fps calculation:
timeNow = ofGetElapsedTimef();
if( ( timeNow - timeThen ) > 0 ) {
fps = 1.0 / (timeNow-timeThen);
frameRate *= 0.9f;
frameRate += 0.1f*fps;
}
timeThen = timeNow;
The || in
if( (timeNow-timeThen) > 0.05f || nFramesForFPS == 0 ) {
Was meaning that we were doing a division by 0 on the next line.
This fix should be in 0.061
Theo