MRPT  2.0.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
mrpt::opengl::CFBORender Class Reference

Detailed Description

A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext).

To define a background color, set it in the scene's "main" viewport.

You can add overlaid text messages, see base class CTextMessageCapable

See also
Example "fbo_render_test"

Definition at line 26 of file CFBORender.h.

#include <mrpt/opengl/CFBORender.h>

Public Member Functions

 CFBORender (unsigned int width=800, unsigned int height=600, const bool skip_glut_window=false)
 Constructor. More...
 
virtual ~CFBORender ()
 Destructor. More...
 
void setCamera (const COpenGLScene &scene, const CCamera &camera)
 Change the scene camera. More...
 
CCameragetCamera (const COpenGLScene &scene)
 Get a reference to the scene camera. More...
 
void getFrame (const COpenGLScene &scene, mrpt::img::CImage &image)
 Render the scene and get the rendered rgb image. More...
 
void getFrame2 (const COpenGLScene &scene, mrpt::img::CImage &image)
 Render the scene and get the rendered rgb image. More...
 
void resize (unsigned int width, unsigned int height)
 Resize the rendering canvas size. More...
 
const mrpt::img::TColorfgetBackgroundColor () const
 Get the default background color (unles an COpenGLViewport defines a custom color) More...
 
void setBackgroundColor (const mrpt::img::TColorf &col)
 Set the default background color (unles an COpenGLViewport defines a custom color) More...
 

Protected Member Functions

int isExtensionSupported (const char *extension)
 Provide information on Framebuffer object extension. More...
 

Protected Attributes

int m_win
 
int m_width
 
int m_height
 
unsigned int m_fbo {0}
 
unsigned int m_tex {0}
 
bool m_win_used
 
mrpt::img::TColorf m_default_bk_color
 

Constructor & Destructor Documentation

◆ CFBORender()

CFBORender::CFBORender ( unsigned int  width = 800,
unsigned int  height = 600,
const bool  skip_glut_window = false 
)

Constructor.

Parameters
[in]skip_glut_windowShould 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.

Definition at line 23 of file CFBORender.cpp.

References argc, argv, ASSERT_, isExtensionSupported(), m_fbo, m_height, m_tex, m_width, m_win, m_win_used, MRPT_END, MRPT_START, and THROW_EXCEPTION.

Here is the call graph for this function:

◆ ~CFBORender()

CFBORender::~CFBORender ( )
virtual

Destructor.

Definition at line 118 of file CFBORender.cpp.

References m_fbo, m_tex, m_win, and m_win_used.

Member Function Documentation

◆ getBackgroundColor()

const mrpt::img::TColorf& mrpt::opengl::CFBORender::getBackgroundColor ( ) const
inline

Get the default background color (unles an COpenGLViewport defines a custom color)

Definition at line 66 of file CFBORender.h.

References m_default_bk_color.

◆ getCamera()

CCamera & CFBORender::getCamera ( const COpenGLScene scene)

Get a reference to the scene camera.

Definition at line 143 of file CFBORender.cpp.

References mrpt::opengl::COpenGLScene::getViewport(), MRPT_END, and MRPT_START.

Here is the call graph for this function:

◆ getFrame()

void CFBORender::getFrame ( const COpenGLScene scene,
mrpt::img::CImage image 
)

Render the scene and get the rendered rgb image.

Resizes the image buffer if it is necessary.

Definition at line 156 of file CFBORender.cpp.

References mrpt::img::CH_RGB, getFrame2(), m_height, m_width, MRPT_END, and MRPT_START.

Here is the call graph for this function:

◆ getFrame2()

void CFBORender::getFrame2 ( const COpenGLScene scene,
mrpt::img::CImage image 
)

Render the scene and get the rendered rgb image.

Does not resize the image buffer. MANDATORY: The image origin must be bottom left.

Definition at line 183 of file CFBORender.cpp.

References mrpt::img::TColorf::A, ASSERT_EQUAL_, mrpt::img::TColorf::B, mrpt::img::TColorf::G, m_default_bk_color, m_fbo, m_height, m_width, MRPT_END, MRPT_START, and mrpt::img::TColorf::R.

Referenced by getFrame().

Here is the caller graph for this function:

◆ isExtensionSupported()

int CFBORender::isExtensionSupported ( const char *  extension)
protected

Provide information on Framebuffer object extension.

Definition at line 270 of file CFBORender.cpp.

References MRPT_END, and MRPT_START.

Referenced by CFBORender().

Here is the caller graph for this function:

◆ resize()

void CFBORender::resize ( unsigned int  width,
unsigned int  height 
)

Resize the rendering canvas size.

Definition at line 223 of file CFBORender.cpp.

References m_fbo, m_height, m_tex, m_width, MRPT_END, and MRPT_START.

◆ setBackgroundColor()

void mrpt::opengl::CFBORender::setBackgroundColor ( const mrpt::img::TColorf col)
inline

Set the default background color (unles an COpenGLViewport defines a custom color)

Definition at line 73 of file CFBORender.h.

References m_default_bk_color.

◆ setCamera()

void CFBORender::setCamera ( const COpenGLScene scene,
const CCamera camera 
)

Change the scene camera.

Definition at line 131 of file CFBORender.cpp.

References mrpt::opengl::COpenGLScene::getViewport(), MRPT_END, and MRPT_START.

Here is the call graph for this function:

Member Data Documentation

◆ m_default_bk_color

mrpt::img::TColorf mrpt::opengl::CFBORender::m_default_bk_color
protected

Definition at line 82 of file CFBORender.h.

Referenced by getBackgroundColor(), getFrame2(), and setBackgroundColor().

◆ m_fbo

unsigned int mrpt::opengl::CFBORender::m_fbo {0}
protected

Definition at line 80 of file CFBORender.h.

Referenced by CFBORender(), getFrame2(), resize(), and ~CFBORender().

◆ m_height

int mrpt::opengl::CFBORender::m_height
protected

Definition at line 79 of file CFBORender.h.

Referenced by CFBORender(), getFrame(), getFrame2(), and resize().

◆ m_tex

unsigned int mrpt::opengl::CFBORender::m_tex {0}
protected

Definition at line 80 of file CFBORender.h.

Referenced by CFBORender(), resize(), and ~CFBORender().

◆ m_width

int mrpt::opengl::CFBORender::m_width
protected

Definition at line 79 of file CFBORender.h.

Referenced by CFBORender(), getFrame(), getFrame2(), and resize().

◆ m_win

int mrpt::opengl::CFBORender::m_win
protected

Definition at line 79 of file CFBORender.h.

Referenced by CFBORender(), and ~CFBORender().

◆ m_win_used

bool mrpt::opengl::CFBORender::m_win_used
protected

Definition at line 81 of file CFBORender.h.

Referenced by CFBORender(), and ~CFBORender().




Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020