Main MRPT website > C++ reference
MRPT logo

CFBORender.h

Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                   http://mrpt.sourceforge.net/                            |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 
00029 #ifndef opengl_CFBORender_H
00030 #define opengl_CFBORender_H
00031 
00032 #include <mrpt/utils/CImage.h>
00033 #include <mrpt/opengl/COpenGLScene.h>
00034 
00035 namespace mrpt
00036 {
00037         namespace opengl
00038         {
00039                 /** A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext).
00040                   *  \note This class is in a "experimental state".
00041                   *  \sa Example "fbo_render_test"
00042                   */
00043                 class OPENGL_IMPEXP CFBORender
00044                 {
00045                 public:
00046 
00047                         /** Constructor
00048                           */
00049                         CFBORender( unsigned int width = 800, unsigned int height = 600 );
00050 
00051                         /** Destructor
00052                          */
00053                         virtual ~CFBORender();
00054 
00055                         /** Change the scene camera.
00056                           */
00057                         void  setCamera( const COpenGLScene& scene, const CCamera& camera );
00058 
00059                         /** Get a reference to the scene camera.
00060                           */
00061                         CCamera  &getCamera( const COpenGLScene& scene );
00062 
00063                         /** Render the scene and get the rendered rgb image. Resizes the image buffer if it
00064                                 is necessary.
00065                           */
00066                         void  getFrame( const COpenGLScene& scene, mrpt::utils::CImage& image );
00067 
00068                         /** Render the scene and get the rendered rgb image. Does not resize the image buffer.
00069                                 MANDATORY: The image origin must be bottom left.
00070                           */
00071                         void  getFrame2( const COpenGLScene& scene, mrpt::utils::CImage& image );
00072 
00073                         /** Resize the image size.
00074                           */
00075                         void  resize( unsigned int width, unsigned int height );
00076 
00077                 protected:
00078                         int m_win, m_width, m_height;
00079                         unsigned int m_fbo, m_tex;
00080 
00081                         /** Provide information on Framebuffer object extension.
00082                           */
00083                         int isExtensionSupported( const char* extension );
00084                 };
00085         } // end namespace
00086 
00087 } // End of namespace
00088 
00089 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011