00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 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 #include <mrpt/opengl/CTextMessageCapable.h> 00035 00036 namespace mrpt 00037 { 00038 namespace opengl 00039 { 00040 /** A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext). 00041 * To define a background color, set it in the scene's "main" viewport. 00042 * 00043 * You can add overlaid text messages, see base class CTextMessageCapable 00044 * 00045 * \sa Example "fbo_render_test" 00046 * \ingroup mrpt_opengl_grp 00047 */ 00048 class OPENGL_IMPEXP CFBORender : public mrpt::opengl::CTextMessageCapable 00049 { 00050 public: 00051 00052 /** Constructor 00053 */ 00054 CFBORender( unsigned int width = 800, unsigned int height = 600 ); 00055 00056 /** Destructor 00057 */ 00058 virtual ~CFBORender(); 00059 00060 /** Change the scene camera. 00061 */ 00062 void setCamera( const COpenGLScene& scene, const CCamera& camera ); 00063 00064 /** Get a reference to the scene camera. 00065 */ 00066 CCamera &getCamera( const COpenGLScene& scene ); 00067 00068 /** Render the scene and get the rendered rgb image. Resizes the image buffer if it 00069 is necessary. 00070 */ 00071 void getFrame( const COpenGLScene& scene, mrpt::utils::CImage& image ); 00072 00073 /** Render the scene and get the rendered rgb image. Does not resize the image buffer. 00074 MANDATORY: The image origin must be bottom left. 00075 */ 00076 void getFrame2( const COpenGLScene& scene, mrpt::utils::CImage& image ); 00077 00078 /** Resize the image size. 00079 */ 00080 void resize( unsigned int width, unsigned int height ); 00081 00082 protected: 00083 int m_win, m_width, m_height; 00084 unsigned int m_fbo, m_tex; 00085 00086 /** Provide information on Framebuffer object extension. 00087 */ 00088 int isExtensionSupported( const char* extension ); 00089 }; 00090 } // end namespace 00091 00092 } // End of namespace 00093 00094 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |