MRPT  2.0.1
CRenderizableShaderText.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
15 #include <mrpt/opengl/TTriangle.h>
16 
17 namespace mrpt::opengl
18 {
19 /** Renderizable generic renderer for objects using the "text shader".
20  *
21  * \sa opengl::COpenGLScene
22  *
23  * \ingroup mrpt_opengl_grp
24  */
25 class CRenderizableShaderText : public virtual CRenderizable
26 {
28 
29  public:
30  CRenderizableShaderText() = default;
31  virtual ~CRenderizableShaderText() override;
32 
33  virtual shader_list_t requiredShaders() const override
34  {
35  return {DefaultShaderID::TEXT};
36  }
37  void render(const RenderContext& rc) const override;
38  void renderUpdateBuffers() const override;
39 
40  /** Must be implemented in derived classes to update the geometric entities
41  * to be drawn in "m_*_buffer" fields. */
42  virtual void onUpdateBuffers_Text() = 0;
43 
44  // See base docs
45  void freeOpenGLResources() override
46  {
51  m_vao.destroy();
52  }
53 
54  protected:
55  /** List of triangles \sa TTriangle */
56  mutable std::vector<mrpt::opengl::TTriangle> m_triangles;
57 
58  /** List of lines */
59  mutable std::vector<mrpt::math::TPoint3Df> m_vertex_buffer_data;
60  mutable std::vector<mrpt::img::TColor> m_color_buffer_data;
61 
62  private:
66 };
67 
68 } // namespace mrpt::opengl
A wrapper for an OpenGL vertex array object (VAO).
A wrapper for an OpenGL buffer object.
Definition: COpenGLBuffer.h:21
virtual void onUpdateBuffers_Text()=0
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
void destroy()
Automatically called upon destructor, no need for the user to call it in normal situations.
Definition: COpenGLBuffer.h:68
The base class of 3D objects that can be directly rendered through OpenGL.
Definition: CRenderizable.h:48
static constexpr shader_id_t TEXT
void destroy()
Automatically called upon destructor, no need for the user to call it in normal situations.
std::vector< shader_id_t > shader_list_t
A list of shader IDs.
Definition: Shader.h:26
void freeOpenGLResources() override
Free opengl buffers.
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
virtual shader_list_t requiredShaders() const override
Returns the ID of the OpenGL shader program required to render this class.
std::vector< mrpt::math::TPoint3Df > m_vertex_buffer_data
List of lines.
Renderizable generic renderer for objects using the "text shader".
virtual ~CRenderizableShaderText() override
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
std::vector< mrpt::opengl::TTriangle > m_triangles
List of triangles.
std::vector< mrpt::img::TColor > m_color_buffer_data



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020