Equalizer  1.4.1
frameBufferObject.h
00001 
00002 /* Copyright (c) 2008-2009, Cedric Stalder <cedric.stalder@gmail.com>
00003                  2009-2012, Stefan Eilemann <eile@equalizergraphics.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef EQUTIL_FRAMEBUFFEROBJECT_H 
00020 #define EQUTIL_FRAMEBUFFEROBJECT_H 
00021 
00022 #include <eq/util/texture.h> // member
00023 #include <eq/util/types.h>
00024 
00025 #include <co/error.h>
00026 
00027 #include <vector>
00028 
00029 namespace eq
00030 {
00031 namespace util
00032 {
00034     class FrameBufferObject 
00035     {
00036     public: 
00038         EQ_API FrameBufferObject( const GLEWContext* const glewContext, 
00039                                   const unsigned textureTarget = 0x84F5
00040                                              /*GL_TEXTURE_RECTANGLE_ARB*/ );
00041 
00043         EQ_API ~FrameBufferObject();
00044 
00056         EQ_API bool addColorTexture();
00057 
00072         EQ_API bool init( const int32_t width, const int32_t height, 
00073                           const unsigned colorFormat, const int32_t depthSize,
00074                           const int32_t stencilSize );
00075 
00077         EQ_API void exit();
00078 
00087         EQ_API void bind();
00088 
00094         EQ_API void unbind();
00095 
00106         EQ_API bool resize( const int32_t width, const int32_t height );
00107 
00109         int32_t getWidth() const
00110             { LBASSERT( !_colors.empty( )); return _colors.front()->getWidth();}
00111 
00113         int32_t getHeight() const
00114             { LBASSERT( !_colors.empty()); return _colors.front()->getHeight();}
00115 
00117         const Textures& getColorTextures() const { return _colors; }
00118 
00120         const Texture& getDepthTexture() const { return _depth; }
00121 
00123         const co::Error& getError() { return _error; }
00124 
00126         const GLEWContext* glewGetContext() const { return _glewContext; }
00127 
00129         bool isValid() const { return _valid; }
00130 
00131     private:
00132         unsigned _fboID; 
00133 
00134         Textures _colors; 
00135         Texture _depth;
00136 
00137         const GLEWContext* const _glewContext;
00138 
00140         co::Error _error;
00141 
00142         bool _valid;
00143 
00144         struct Private;
00145         Private* _private; // placeholder for binary-compatible changes
00146 
00147         LB_TS_VAR( _thread );
00148 
00150         bool _checkStatus();
00151 
00152         void _setError( const int32_t error );
00153     };
00154 }
00155 }
00156 
00157 #endif // EQUTIL_FRAMEBUFFEROBJECT_H 
Generated on Mon Nov 26 2012 14:41:48 for Equalizer 1.4.1 by  doxygen 1.7.6.1