Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
17namespace 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;
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 camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition CCamera.h:32
A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext).
Definition CFBORender.h:30
void setCamera(const COpenGLScene &scene, const CCamera &camera)
Change the scene camera.
void setBackgroundColor(const mrpt::utils::TColorf &col)
Set the default background color (unles an COpenGLViewport defines a custom color)
Definition CFBORender.h:65
virtual ~CFBORender()
Destructor.
CCamera & getCamera(const COpenGLScene &scene)
Get a reference to the scene camera.
void resize(unsigned int width, unsigned int height)
Resize the rendering canvas size.
void getFrame(const COpenGLScene &scene, mrpt::utils::CImage &image)
Render the scene and get the rendered rgb image.
mrpt::utils::TColorf m_default_bk_color
Definition CFBORender.h:71
CFBORender(unsigned int width=800, unsigned int height=600, const bool skip_glut_window=false)
Constructor.
void getFrame2(const COpenGLScene &scene, mrpt::utils::CImage &image)
Render the scene and get the rendered rgb image.
const mrpt::utils::TColorf & getBackgroundColor() const
Get the default background color (unles an COpenGLViewport defines a custom color)
Definition CFBORender.h:62
int isExtensionSupported(const char *extension)
Provide information on Framebuffer object extension.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
Keeps a list of text messages which can be rendered to OpenGL contexts by graphic classes.
A class for storing images as grayscale or RGB bitmaps.
Definition CImage.h:102
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A RGB color - floats in the range [0,1].
Definition TColor.h:53



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Fri Dec 15 05:36:48 UTC 2023