Main MRPT website
>
C++ reference for MRPT 1.5.9
mrpt
opengl
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
>
14
#include <
mrpt/opengl/COpenGLScene.h
>
15
#include <
mrpt/opengl/CTextMessageCapable.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
*/
29
class
OPENGL_IMPEXP
CFBORender
:
public
mrpt::opengl::CTextMessageCapable
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
;
71
mrpt::utils::TColorf
m_default_bk_color
;
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
mrpt::opengl::CFBORender::m_win_used
bool m_win_used
Definition:
CFBORender.h:70
mrpt::utils::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition:
CImage.h:101
mrpt::opengl::CTextMessageCapable
Keeps a list of text messages which can be rendered to OpenGL contexts by graphic classes...
Definition:
CTextMessageCapable.h:24
CTextMessageCapable.h
image
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition:
glext.h:3522
mrpt::opengl::CFBORender::m_default_bk_color
mrpt::utils::TColorf m_default_bk_color
Definition:
CFBORender.h:71
width
GLenum GLsizei width
Definition:
glext.h:3513
mrpt::opengl::CFBORender::setBackgroundColor
void setBackgroundColor(const mrpt::utils::TColorf &col)
Set the default background color (unles an COpenGLViewport defines a custom color) ...
Definition:
CFBORender.h:65
mrpt::opengl::CFBORender::m_tex
unsigned int m_tex
Definition:
CFBORender.h:69
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition:
CParticleFilter.h:16
COpenGLScene.h
mrpt::opengl::CFBORender::m_win
int m_win
Definition:
CFBORender.h:68
mrpt::opengl::COpenGLScene
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
Definition:
COpenGLScene.h:49
mrpt::utils::TColorf
A RGB color - floats in the range [0,1].
Definition:
TColor.h:80
mrpt::opengl::CFBORender::getBackgroundColor
const mrpt::utils::TColorf & getBackgroundColor() const
Get the default background color (unles an COpenGLViewport defines a custom color) ...
Definition:
CFBORender.h:62
OPENGL_IMPEXP
#define OPENGL_IMPEXP
Definition:
opengl/include/mrpt/opengl/link_pragmas.h:42
mrpt::opengl::CCamera
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition:
CCamera.h:31
height
GLenum GLsizei GLsizei height
Definition:
glext.h:3523
CImage.h
mrpt::opengl::CFBORender
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.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020