cgv
Loading...
Searching...
No Matches
cgv::render::gl::gl_time_query Class Reference

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
 

Detailed Description

OpenGL helper class to perform time measurements.

Definition at line 12 of file gl_time_query.h.

Constructor & Destructor Documentation

◆ gl_time_query()

cgv::render::gl::gl_time_query::gl_time_query ( )

construct an uninitialized time query

Definition at line 9 of file gl_time_query.cxx.

◆ ~gl_time_query()

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().

Member Function Documentation

◆ begin()

void cgv::render::gl::gl_time_query::begin ( ) const

begin the time measurement

Definition at line 71 of file gl_time_query.cxx.

◆ begin_scope()

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.

◆ collect()

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.

◆ destruct()

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().

◆ end()

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.

◆ end_scope()

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.

◆ end_scope_and_collect()

double cgv::render::gl::gl_time_query::end_scope_and_collect ( ) const
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.

◆ init()

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.

◆ is_initialized()

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().

Member Data Documentation

◆ last_error

std::string cgv::render::gl::gl_time_query::last_error
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().


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