Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

glt/frame.h

Go to the documentation of this file.
00001 #ifndef GLT_FRAME_H
00002 #define GLT_FRAME_H
00003 
00004 /*
00005 
00006   GLT OpenGL C++ Toolkit      
00007   Copyright (C) 2000-2002 Nigel Stewart
00008   Email: nigels.com@gmail.com   WWW: http://www.nigels.com/glt/
00009 
00010   This library is free software; you can redistribute it and/or
00011   modify it under the terms of the GNU Lesser General Public
00012   License as published by the Free Software Foundation; either
00013   version 2.1 of the License, or (at your option) any later version.
00014 
00015   This library is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018   Lesser General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public
00021   License along with this library; if not, write to the Free Software
00022   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 
00024 */
00025 
00039 #include <iosfwd>
00040 #include <vector>
00041 #include <string>
00042 
00043 #include <misc/timer.h>
00044 #include <misc/cbuffer.h>
00045 
00051 class GltFrameRate
00052 {
00053 public:
00055     GltFrameRate(const int sampleSize = 11);
00057     ~GltFrameRate();
00058 
00060     GltFrameRate &operator++();
00061     
00063     double elapsedTime() const;
00065     int   totalFrames() const;
00066 
00068     double frameRate() const;
00070     double frameTime() const;
00071 
00073     std::string summary() const;
00074 
00076     std::string detailed() const;
00077 
00078 private:
00079 
00080     Timer           _timer;             // Timer used for frame rate calculation
00081     int             _frames;            // Total number of frames
00082     double          _step;              // Minimum time step between recalculation
00083     
00084     double          _lastCalc;          // Time of last recalculation
00085     double          _lastFrameRate;     // Previously calculated frame rate (frame/sec)
00086     double          _lastFrameTime;     // Previously calculated frame time (sec/frame)
00087     
00088     cbuffer<double> _buffer;            // Circular buffer storage 
00089 };
00090 
00091 #endif

Generated on Tue Nov 5 11:11:03 2002 for GLT by doxygen1.2.18