The boost::timer comes from the boost library and is a wrapper around clock(), cformat() is a wrapper around vsnprintf().
The problem is that many times, on a fast graphics card, I get infinite fps as a result. That is, it is as if no time has elapsed in the rendering loop. Is there a portable way to achieve accurate timing? Should I use the GL timer extension?
From a cursory glance on the Boost doc, this timer.elapsed() returns time in INTEGER SECONDS ! Expecting to do something usefull with that on a single frame is beyond me …
You may want to average fps during one second, ie. count number of rendered frames and display this number each time timer.elapsed() changes (each second).
double elapsed() const; // return elapsed time in seconds
Nothing prevents this method from returning say .001 seconds or .000001 seconds as the elapsed time and it is returning a double thus allowing high resolution. The fps average idea is good, but how to handle infinite fps?