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
#include <mrpt/opengl/CFBORender.h>

Public Member Functions | |
| CFBORender (unsigned int width=800, unsigned int height=600) | |
| Constructor. | |
| virtual | ~CFBORender () |
| Destructor. | |
| void | setCamera (const COpenGLScene &scene, const CCamera &camera) |
| Change the scene camera. | |
| CCamera & | getCamera (const COpenGLScene &scene) |
| Get a reference to the scene camera. | |
| void | getFrame (const COpenGLScene &scene, mrpt::utils::CImage &image) |
| Render the scene and get the rendered rgb image. | |
| void | getFrame2 (const COpenGLScene &scene, mrpt::utils::CImage &image) |
| Render the scene and get the rendered rgb image. | |
| void | resize (unsigned int width, unsigned int height) |
| Resize the image size. | |
| void | clearTextMessages () |
| void | addTextMessage (const double x_frac, const double y_frac, const std::string &text, const mrpt::utils::TColorf &color=mrpt::utils::TColorf(1.0, 1.0, 1.0), const size_t unique_index=0, const mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24) |
| Add 2D text messages overlapped to the 3D rendered scene. | |
| void | addTextMessage (const double x_frac, const double y_frac, const std::string &text, const mrpt::utils::TColorf &color, const std::string &font_name, const double font_size, const mrpt::opengl::TOpenGLFontStyle font_style=mrpt::opengl::NICE, const size_t unique_index=0, const double font_spacing=1.5, const double font_kerning=0.1) |
Protected Member Functions | |
| int | isExtensionSupported (const char *extension) |
| Provide information on Framebuffer object extension. | |
| void | render_text_messages (const int w, const int h) const |
| Renders the messages to the current opengl rendering context (to be called OUT of MRPT mrpt::opengl render() methods ). | |
Protected Attributes | |
| int | m_win |
| int | m_width |
| int | m_height |
| unsigned int | m_fbo |
| unsigned int | m_tex |
| std::map< size_t, mrpt::opengl::T2DTextData > | m_2D_texts |
| mrpt::opengl::CFBORender::CFBORender | ( | unsigned int | width = 800, |
| unsigned int | height = 600 |
||
| ) |
Constructor.
| virtual mrpt::opengl::CFBORender::~CFBORender | ( | ) | [virtual] |
Destructor.
| void mrpt::opengl::CTextMessageCapable::addTextMessage | ( | const double | x_frac, |
| const double | y_frac, | ||
| const std::string & | text, | ||
| const mrpt::utils::TColorf & | color = mrpt::utils::TColorf(1.0, 1.0, 1.0), |
||
| const size_t | unique_index = 0, |
||
| const mrpt::opengl::TOpenGLFont | font = mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24 |
||
| ) | [inherited] |
Add 2D text messages overlapped to the 3D rendered scene.
The string will remain displayed in the 3D window until it's changed with subsequent calls to this same method, or all the texts are cleared with clearTextMessages().
| x | The X position, interpreted as absolute pixels from the left if X>=1, absolute pixels from the left if X<0 or as a width factor if in the range [0,1[. |
| y | The Y position, interpreted as absolute pixels from the bottom if Y>=1, absolute pixels from the top if Y<0 or as a height factor if in the range [0,1[. |
| text | The text string to display. |
| color | The text color. For example: TColorf(1.0,1.0,1.0) |
| unique_index | An "index" for this text message, so that subsequent calls with the same index will overwrite this text message instead of creating new ones. |
You'll need to refresh the display manually with forceRepaint().
| void mrpt::opengl::CTextMessageCapable::addTextMessage | ( | const double | x_frac, |
| const double | y_frac, | ||
| const std::string & | text, | ||
| const mrpt::utils::TColorf & | color, | ||
| const std::string & | font_name, | ||
| const double | font_size, | ||
| const mrpt::opengl::TOpenGLFontStyle | font_style = mrpt::opengl::NICE, |
||
| const size_t | unique_index = 0, |
||
| const double | font_spacing = 1.5, |
||
| const double | font_kerning = 0.1 |
||
| ) | [inherited] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void mrpt::opengl::CTextMessageCapable::clearTextMessages | ( | ) | [inherited] |
| CCamera& mrpt::opengl::CFBORender::getCamera | ( | const COpenGLScene & | scene | ) |
Get a reference to the scene camera.
| void mrpt::opengl::CFBORender::getFrame | ( | const COpenGLScene & | scene, |
| mrpt::utils::CImage & | image | ||
| ) |
Render the scene and get the rendered rgb image.
Resizes the image buffer if it is necessary.
| void mrpt::opengl::CFBORender::getFrame2 | ( | const COpenGLScene & | scene, |
| mrpt::utils::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.
| int mrpt::opengl::CFBORender::isExtensionSupported | ( | const char * | extension | ) | [protected] |
Provide information on Framebuffer object extension.
| void mrpt::opengl::CTextMessageCapable::render_text_messages | ( | const int | w, |
| const int | h | ||
| ) | const [protected, inherited] |
Renders the messages to the current opengl rendering context (to be called OUT of MRPT mrpt::opengl render() methods ).
(w,h) are the dimensions of the rendering area in pixels.
| void mrpt::opengl::CFBORender::resize | ( | unsigned int | width, |
| unsigned int | height | ||
| ) |
Resize the image size.
| void mrpt::opengl::CFBORender::setCamera | ( | const COpenGLScene & | scene, |
| const CCamera & | camera | ||
| ) |
Change the scene camera.
std::map<size_t,mrpt::opengl::T2DTextData> mrpt::opengl::CTextMessageCapable::m_2D_texts [protected, inherited] |
Definition at line 45 of file CTextMessageCapable.h.
unsigned int mrpt::opengl::CFBORender::m_fbo [protected] |
Definition at line 84 of file CFBORender.h.
int mrpt::opengl::CFBORender::m_height [protected] |
Definition at line 83 of file CFBORender.h.
unsigned int mrpt::opengl::CFBORender::m_tex [protected] |
Definition at line 84 of file CFBORender.h.
int mrpt::opengl::CFBORender::m_width [protected] |
Definition at line 83 of file CFBORender.h.
int mrpt::opengl::CFBORender::m_win [protected] |
Definition at line 83 of file CFBORender.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |