cgv
|
OpenGL helper class to perform time measurements. More...
#include <gl_time_query.h>
Public Member Functions | |
gl_time_query () | |
construct an uninitialized time query | |
~gl_time_query () | |
destruct the query | |
bool | init (context &ctx) |
initialize the time query by generating the query object, return success | |
void | destruct (context &ctx) |
deinitialize the query | |
bool | is_initialized () const |
check whether the time query has been initialized, i.e. the init method has been called successfully before | |
void | begin_scope () const |
start scoping OpenGL commands for time measurement | |
void | end_scope () const |
close the scope of OpenGL commands included in the time measurement | |
double | collect () const |
collect the measured time, blocking until the query object is ready and the time can be retrieved | |
double | end_scope_and_collect () const |
close the scope of OpenGL commands included in the time measurement and retrieve the duration immediately, blocking until the query object is ready and the time can be retrieved | |
void | begin () const |
begin the time measurement | |
double | end () const |
end the time measurement and return elapsed time in nanoseconds (1 second = 10^9 nanoseconds) | |
Public Attributes | |
std::string | last_error |
a string that contains the last error, which is only set by the init method | |
OpenGL helper class to perform time measurements.
Definition at line 12 of file gl_time_query.h.
cgv::render::gl::gl_time_query::gl_time_query | ( | ) |
construct an uninitialized time query
Definition at line 9 of file gl_time_query.cxx.
cgv::render::gl::gl_time_query::~gl_time_query | ( | ) |
destruct the query
Definition at line 13 of file gl_time_query.cxx.
References destruct(), and is_initialized().
void cgv::render::gl::gl_time_query::begin | ( | ) | const |
begin the time measurement
Definition at line 71 of file gl_time_query.cxx.
void cgv::render::gl::gl_time_query::begin_scope | ( | ) | const |
start scoping OpenGL commands for time measurement
Definition at line 49 of file gl_time_query.cxx.
double cgv::render::gl::gl_time_query::collect | ( | ) | const |
collect the measured time, blocking until the query object is ready and the time can be retrieved
Definition at line 59 of file gl_time_query.cxx.
void cgv::render::gl::gl_time_query::destruct | ( | context & | ctx | ) |
deinitialize the query
Definition at line 36 of file gl_time_query.cxx.
Referenced by ~gl_time_query().
double cgv::render::gl::gl_time_query::end | ( | ) | const |
end the time measurement and return elapsed time in nanoseconds (1 second = 10^9 nanoseconds)
Definition at line 76 of file gl_time_query.cxx.
void cgv::render::gl::gl_time_query::end_scope | ( | ) | const |
close the scope of OpenGL commands included in the time measurement
Definition at line 54 of file gl_time_query.cxx.
|
inline |
close the scope of OpenGL commands included in the time measurement and retrieve the duration immediately, blocking until the query object is ready and the time can be retrieved
Definition at line 43 of file gl_time_query.h.
bool cgv::render::gl::gl_time_query::init | ( | context & | ctx | ) |
initialize the time query by generating the query object, return success
Definition at line 19 of file gl_time_query.cxx.
References cgv::render::gl::ensure_glew_initialized(), and last_error.
bool cgv::render::gl::gl_time_query::is_initialized | ( | ) | const |
check whether the time query has been initialized, i.e. the init method has been called successfully before
Definition at line 44 of file gl_time_query.cxx.
Referenced by ~gl_time_query().
|
mutable |
a string that contains the last error, which is only set by the init method
Definition at line 20 of file gl_time_query.h.
Referenced by init().