Main MRPT website > C++ reference for MRPT 1.9.9
CFBORender.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef opengl_CFBORender_H
11 #define opengl_CFBORender_H
12 
13 #include <mrpt/img/CImage.h>
16 
17 namespace mrpt
18 {
19 namespace opengl
20 {
21 /** A class for rendering 3D scenes off-screen directly into an image using
22  * OpenGL extensions (glext).
23  * To define a background color, set it in the scene's "main" viewport.
24  *
25  * You can add overlaid text messages, see base class CTextMessageCapable
26  *
27  * \sa Example "fbo_render_test"
28  * \ingroup mrpt_opengl_grp
29  */
31 {
32  public:
33  /** Constructor.
34  * \param[in] skip_glut_window Should be set to true only if another GUI
35  * windows already exist with an associated OpenGL context. If left to
36  * false, a hidden GLUT window will be created.
37  */
38  CFBORender(
39  unsigned int width = 800, unsigned int height = 600,
40  const bool skip_glut_window = false);
41 
42  /** Destructor */
43  virtual ~CFBORender();
44 
45  /** Change the scene camera.
46  */
47  void setCamera(const COpenGLScene& scene, const CCamera& camera);
48 
49  /** Get a reference to the scene camera.
50  */
51  CCamera& getCamera(const COpenGLScene& scene);
52 
53  /** Render the scene and get the rendered rgb image. Resizes the image
54  buffer if it
55  is necessary.
56  */
57  void getFrame(const COpenGLScene& scene, mrpt::img::CImage& image);
58 
59  /** Render the scene and get the rendered rgb image. Does not resize the
60  image buffer.
61  MANDATORY: The image origin must be bottom left.
62  */
63  void getFrame2(const COpenGLScene& scene, mrpt::img::CImage& image);
64 
65  /** Resize the rendering canvas size. */
66  void resize(unsigned int width, unsigned int height);
67 
68  /** Get the default background color (unles an COpenGLViewport defines a
69  * custom color) */
71  {
72  return m_default_bk_color;
73  }
74 
75  /** Set the default background color (unles an COpenGLViewport defines a
76  * custom color) */
78  {
79  m_default_bk_color = col;
80  }
81 
82  protected:
84  unsigned int m_fbo, m_tex;
85  bool m_win_used;
87 
88  /** Provide information on Framebuffer object extension.
89  */
90  int isExtensionSupported(const char* extension);
91 };
92 } // end namespace
93 
94 } // End of namespace
95 
96 #endif
CFBORender(unsigned int width=800, unsigned int height=600, const bool skip_glut_window=false)
Constructor.
Definition: CFBORender.cpp:23
int isExtensionSupported(const char *extension)
Provide information on Framebuffer object extension.
Definition: CFBORender.cpp:280
Keeps a list of text messages which can be rendered to OpenGL contexts by graphic classes...
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glext.h:3551
void getFrame(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
Definition: CFBORender.cpp:156
GLenum GLsizei width
Definition: glext.h:3531
const mrpt::img::TColorf & getBackgroundColor() const
Get the default background color (unles an COpenGLViewport defines a custom color) ...
Definition: CFBORender.h:70
CCamera & getCamera(const COpenGLScene &scene)
Get a reference to the scene camera.
Definition: CFBORender.cpp:143
virtual ~CFBORender()
Destructor.
Definition: CFBORender.cpp:118
void setBackgroundColor(const mrpt::img::TColorf &col)
Set the default background color (unles an COpenGLViewport defines a custom color) ...
Definition: CFBORender.h:77
void getFrame2(const COpenGLScene &scene, mrpt::img::CImage &image)
Render the scene and get the rendered rgb image.
Definition: CFBORender.cpp:185
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void setCamera(const COpenGLScene &scene, const CCamera &camera)
Change the scene camera.
Definition: CFBORender.cpp:131
void resize(unsigned int width, unsigned int height)
Resize the rendering canvas size.
Definition: CFBORender.cpp:231
A RGB color - floats in the range [0,1].
Definition: TColor.h:79
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
Definition: COpenGLScene.h:59
mrpt::img::TColorf m_default_bk_color
Definition: CFBORender.h:86
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition: CCamera.h:30
GLenum GLsizei GLsizei height
Definition: glext.h:3554
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext)...
Definition: CFBORender.h:30



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019