38 #if MRPT_HAS_OPENGL_GLUT 40 glGenBuffers(1, &buffer);
41 this->buffer_id = buffer;
42 this->created_from = std::this_thread::get_id();
51 static const bool showErrs =
52 (::getenv(
"MRPT_REVEAL_OPENGL_BUFFER_LEAKS") !=
nullptr);
54 #if MRPT_HAS_OPENGL_GLUT 55 if (created_from == std::this_thread::get_id())
58 glDeleteBuffers(1, &buffer_id);
63 static double tLast = 0;
65 if (tNow - tLast > 2.0)
72 std::cerr <<
"[COpenGLBuffer::RAII_Impl] *Warning* Leaking memory " 73 "since Buffer was acquired from a different thread " 74 "and cannot free it from this thread, call stack:" 85 #if MRPT_HAS_OPENGL_GLUT 87 glBindBuffer(static_cast<GLenum>(
type), buffer_id);
93 #if MRPT_HAS_OPENGL_GLUT 95 if (created_from != std::this_thread::get_id())
return;
97 glBindBuffer(static_cast<GLenum>(
type), 0);
103 #if MRPT_HAS_OPENGL_GLUT 106 static_cast<GLenum>(
type), byteCount,
data, static_cast<GLenum>(
usage));
static double toDouble(const time_point t) noexcept
Converts a timestamp to a UNIX time_t-like number, with fractional part.
void destroy()
Automatically called upon destructor, no need for the user to call it in normal situations.
RAII_Impl(COpenGLBuffer::Type t)
static time_point now() noexcept
Returns the current time using the currently selected Clock source.
void getCallStackBackTrace(TCallStackBackTrace &out_bt)
Returns a list of strings representing the current call stack backtrace.
#define ASSERT_(f)
Defines an assertion mechanism.
std::shared_ptr< RAII_Impl > m_impl
void allocate(const void *data, int byteCount)
See: getCallStackBackTrace()
The namespace for 3D scene representation and rendering.
std::string asString() const
Prints all backtrace entries, one per line in a human-readable format.
static struct FontData data