Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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/utils/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 OpenGL extensions (glext).
22  * To define a background color, set it in the scene's "main" viewport.
23  *
24  * You can add overlaid text messages, see base class CTextMessageCapable
25  *
26  * \sa Example "fbo_render_test"
27  * \ingroup mrpt_opengl_grp
28  */
30  {
31  public:
32  /** Constructor.
33  * \param[in] skip_glut_window Should be set to true only if another GUI windows already exist with an associated OpenGL context. If left to false, a hidden GLUT window will be created.
34  */
35  CFBORender( unsigned int width = 800, unsigned int height = 600, const bool skip_glut_window = false );
36 
37  /** Destructor */
38  virtual ~CFBORender();
39 
40  /** Change the scene camera.
41  */
42  void setCamera( const COpenGLScene& scene, const CCamera& camera );
43 
44  /** Get a reference to the scene camera.
45  */
46  CCamera &getCamera( const COpenGLScene& scene );
47 
48  /** Render the scene and get the rendered rgb image. Resizes the image buffer if it
49  is necessary.
50  */
51  void getFrame( const COpenGLScene& scene, mrpt::utils::CImage& image );
52 
53  /** Render the scene and get the rendered rgb image. Does not resize the image buffer.
54  MANDATORY: The image origin must be bottom left.
55  */
56  void getFrame2( const COpenGLScene& scene, mrpt::utils::CImage& image );
57 
58  /** Resize the rendering canvas size. */
59  void resize( unsigned int width, unsigned int height );
60 
61  /** Get the default background color (unles an COpenGLViewport defines a custom color) */
62  const mrpt::utils::TColorf & getBackgroundColor() const { return m_default_bk_color; }
63 
64  /** Set the default background color (unles an COpenGLViewport defines a custom color) */
65  void setBackgroundColor(const mrpt::utils::TColorf &col){ m_default_bk_color=col; }
66 
67  protected:
68  int m_win, m_width, m_height;
69  unsigned int m_fbo, m_tex;
70  bool m_win_used;
72 
73  /** Provide information on Framebuffer object extension.
74  */
75  int isExtensionSupported( const char* extension );
76  };
77  } // end namespace
78 
79 } // End of namespace
80 
81 #endif
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
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:3522
mrpt::utils::TColorf m_default_bk_color
Definition: CFBORender.h:71
GLenum GLsizei width
Definition: glext.h:3513
void setBackgroundColor(const mrpt::utils::TColorf &col)
Set the default background color (unles an COpenGLViewport defines a custom color) ...
Definition: CFBORender.h:65
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
Definition: COpenGLScene.h:49
A RGB color - floats in the range [0,1].
Definition: TColor.h:80
const mrpt::utils::TColorf & getBackgroundColor() const
Get the default background color (unles an COpenGLViewport defines a custom color) ...
Definition: CFBORender.h:62
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition: CCamera.h:31
GLenum GLsizei GLsizei height
Definition: glext.h:3523
A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext)...
Definition: CFBORender.h:29



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019