cgv
Loading...
Searching...
No Matches
gl_time_query.h
1#pragma once
2
3#include <cgv/render/texture.h>
4
5#include "lib_begin.h"
6
7namespace cgv {
8 namespace render {
9 namespace gl {
10
12class CGV_API gl_time_query
13{
14private:
15 context* ctx_ptr = nullptr;
16 unsigned int query = 0;
17
18public:
20 mutable std::string last_error;
21
26
28 bool init(context& ctx);
30 void destruct(context& ctx);
32 bool is_initialized() const;
33
35 void begin_scope() const;
37 void end_scope() const;
39 double collect() const;
40
43 inline double end_scope_and_collect() const {
44 end_scope();
45 return collect();
46 }
47
49 [[deprecated("Use begin_scope() instead, which does the exact same thing, but is named more clearly and fits better with the new way of using gl_time_query.")]]
50 void begin() const;
52 [[deprecated("This method blocks the calling thread until the scoped commands finish executing. Use end_scope() and collect() instead.")]]
53 double end() const;
54};
55
56 } // namespace cgv
57 } // namespace render
58} // namespace gl
59
60#include <cgv/config/lib_end.h>
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
OpenGL helper class to perform time measurements.
double end_scope_and_collect() const
close the scope of OpenGL commands included in the time measurement and retrieve the duration immedia...
std::string last_error
a string that contains the last error, which is only set by the init method
the cgv namespace
Definition print.h:11