Equalizer  1.2.1
frameBufferObject.h
00001 
00002 /* Copyright (c) 2008-2009, Cedric Stalder <cedric.stalder@gmail.com>
00003                  2009-2011, 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 <eq/client/gl.h>           // for GLEW
00026 #include <co/base/error.h>
00027 
00028 #include <vector>
00029 
00030 namespace eq
00031 {
00032 namespace util
00033 {
00035     class FrameBufferObject 
00036     {
00037     public: 
00039         EQ_API FrameBufferObject( const GLEWContext* const glewContext, 
00040                   const GLenum textureTarget = 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 GLuint 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             { EQASSERT( !_colors.empty( )); return _colors.front()->getWidth();}
00111 
00113         int32_t getHeight() const
00114             { EQASSERT( !_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::base::Error& getError() { return _error; }
00124 
00126         const GLEWContext* glewGetContext() const { return _glewContext; }
00127 
00129         bool isValid() const { return _valid; }
00130 
00131     private:
00132         GLuint _fboID; 
00133 
00134         Textures _colors; 
00135         Texture _depth;
00136 
00137         const GLEWContext* const _glewContext;
00138 
00140         co::base::Error _error;
00141 
00142         bool _valid;
00143 
00144         struct Private;
00145         Private* _private; // placeholder for binary-compatible changes
00146 
00147         EQ_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 Fri Jun 8 2012 15:44:30 for Equalizer 1.2.1 by  doxygen 1.8.0