Easy3D 2.5.3
OpenGLTimer Class Reference

Accurate timing of GPU operations. More...

#include <easy3d/renderer/opengl_timer.h>

Public Member Functions

 OpenGLTimer (bool start_timing=true)
 
void start ()
 
bool is_running () const
 
void stop ()
 
double time ()
 

Detailed Description

Accurate timing of GPU operations.

Because the GPU is based on an asynchronously processed command stream that is implicitly generated by OpenGL calls, it is not possible to determine the amount of time spent processing a set of OpenGL calls by timing the calls themselves at the application level. Instead, the timing must be done via an asynchronous timer system. This timer are started and stopped at the beginning and end of the OpenGL commands of interest. However, the timings results must be queried at some point later, as the pipeline must complete before the timer values are known. This class implements such a timer that behaves like a CPU timer (See StopWatch)

Usage example:

OpenGLTimer t;
// opengl calls ...
draw();
fprintf(stdout, "\rTime: %2.4f ms ", t.time());

The documentation for this class was generated from the following files: