text_drawable.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2025, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef TANGO_TEXT_DRAWABLE_H_
29 #define TANGO_TEXT_DRAWABLE_H_
30 
31 #include <vector>
32 #include <rtabmap/core/Transform.h>
33 #include <tango-gl/color.h>
34 
35 // PointCloudDrawable is responsible for the point cloud rendering.
36 class TextDrawable {
37 private:
40  static float textUVWidth_;
41  static float textUVHeight_;
42  static float textHeight_;
43  static std::vector<float> textCharacterWidths_;
44 
45 public:
46  static void createShaderProgram();
47  static void releaseShaderProgram();
48 
49 public:
51  const std::string & text,
52  const rtabmap::Transform & pose,
53  float textSize = 0.1f, // meters
54  const tango_gl::Color & color = tango_gl::Color(1,0,0));
55 
56  virtual ~TextDrawable() {}
57 
58  void Render(
59  const glm::mat4 & projectionMatrix,
60  const glm::mat4 & viewMatrix,
61  const glm::mat4 & viewMatrixRotInv) const;
62 
63  private:
64  std::vector<float> vertexBuffer_;
65  std::vector<float> textureBuffer_;
66  std::vector<unsigned short> drawListBuffer_;
69 };
70 
71 #endif // TANGO_POINT_CLOUD_POINT_CLOUD_DRAWABLE_H_
TextDrawable::textHeight_
static float textHeight_
Definition: text_drawable.h:42
TextDrawable::textTextureId_
static GLuint textTextureId_
Definition: text_drawable.h:39
TextDrawable::vertexBuffer_
std::vector< float > vertexBuffer_
Definition: text_drawable.h:64
TextDrawable::color_
tango_gl::Color color_
Definition: text_drawable.h:68
Transform.h
glm::detail::tmat4x4
Definition: type_mat.hpp:47
TextDrawable::Render
void Render(const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix, const glm::mat4 &viewMatrixRotInv) const
Definition: text_drawable.cpp:315
TextDrawable::textUVHeight_
static float textUVHeight_
Definition: text_drawable.h:41
TextDrawable::textCharacterWidths_
static std::vector< float > textCharacterWidths_
Definition: text_drawable.h:43
GLuint
unsigned int GLuint
Definition: dummy.cpp:78
TextDrawable::createShaderProgram
static void createShaderProgram()
Definition: text_drawable.cpp:71
TextDrawable::textUVWidth_
static float textUVWidth_
Definition: text_drawable.h:40
TextDrawable::textureBuffer_
std::vector< float > textureBuffer_
Definition: text_drawable.h:65
TextDrawable
Definition: text_drawable.h:36
TextDrawable::drawListBuffer_
std::vector< unsigned short > drawListBuffer_
Definition: text_drawable.h:66
TextDrawable::TextDrawable
TextDrawable(const std::string &text, const rtabmap::Transform &pose, float textSize=0.1f, const tango_gl::Color &color=tango_gl::Color(1, 0, 0))
Definition: text_drawable.cpp:209
TextDrawable::textProgram_
static GLuint textProgram_
Definition: text_drawable.h:38
TextDrawable::releaseShaderProgram
static void releaseShaderProgram()
Definition: text_drawable.cpp:200
rtabmap::Transform
Definition: Transform.h:41
tango_gl::Color
Definition: color.h:21
TextDrawable::poseGl_
glm::mat4 poseGl_
Definition: text_drawable.h:67
TextDrawable::~TextDrawable
virtual ~TextDrawable()
Definition: text_drawable.h:56
color.h


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Apr 28 2025 02:46:05