Easy3D 2.6.1
Loading...
Searching...
No Matches
opengl_timer.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_RENDERER_OPENGL_TIMER_H
28#define EASY3D_RENDERER_OPENGL_TIMER_H
29
30namespace easy3d {
31
54 {
55 public:
60 explicit OpenGLTimer(bool start_timing = true);
64 virtual ~OpenGLTimer();
65
70 void start();
71
76 bool is_running() const { return running_; }
77
82 void stop();
83
88 double time();
89
90 protected:
91 unsigned int query_id_;
92 bool running_;
93 };
94
95}
96
97
98#endif // EASY3D_RENDERER_OPENGL_TIMER_H
bool is_running() const
Check if the timer is running.
Definition opengl_timer.h:76
double time()
Get the GPU time consumed since the last start.
Definition opengl_timer.cpp:68
OpenGLTimer(bool start_timing=true)
Constructor.
Definition opengl_timer.cpp:37
void start()
Start the timer. The next OpenGL call will be the first timed.
Definition opengl_timer.cpp:55
void stop()
Stop the timer. The previous OpenGL call will be the last timed.
Definition opengl_timer.cpp:62
virtual ~OpenGLTimer()
Destructor.
Definition opengl_timer.cpp:48
Definition collider.cpp:182