frameBufferObject.h

00001 
00002 /* Copyright (c) 2008-2009, Cedric Stalder <cedric.stalder@gmail.com>
00003                  2009, 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 EQ_FRAMEBUFFEROBJECT_H 
00020 #define EQ_FRAMEBUFFEROBJECT_H 
00021 
00022 #include <eq/client/windowSystem.h> // for GL types
00023 #include <eq/client/texture.h>      // member
00024 
00025 #include <vector>
00026 
00027 namespace eq
00028 {
00030     class FrameBufferObject 
00031     {
00032     public: 
00034         FrameBufferObject( GLEWContext* const glewContext );
00035 
00037         ~FrameBufferObject();
00038 
00040         bool init( const int width, const int height, 
00041                    const int depthSize, const int stencilSize );
00042 
00049         void setColorFormat( const GLuint format );
00050 
00052         void exit();
00053 
00055         void bind();
00056 
00058         void unbind();
00059 
00060         /* Resize FBO, if needed. */
00061         bool resize( const int width, const int height );
00062 
00063         GLEWContext* glewGetContext() { return _glewContext; }
00064         const GLEWContext* glewGetContext() const { return _glewContext; }
00065 
00067         const TextureVector& getColorTextures() const { return _colors; }
00068 
00070         const Texture& getDepthTexture() const { return _depth; }
00071 
00073         const Texture& getStencilTexture() const { return _stencil; }
00074 
00076         const std::string& getErrorMessage() { return _error; }
00077 
00079         PixelViewport getPixelViewport() const;
00080 
00088         bool addColorTexture( );
00089 
00090     private:
00091         GLuint _fboID;
00092 
00093         int _width;
00094         int _height;
00095 
00096         TextureVector _colors; 
00097 
00098         Texture _depth;
00099         Texture _stencil;
00100 
00101         GLEWContext* const _glewContext;
00102 
00104         std::string _error;
00105 
00106         bool _valid;
00107 
00108         union // placeholder for binary-compatible changes
00109         {
00110             char dummy[64];
00111         };
00112 
00113         CHECK_THREAD_DECLARE( _thread );
00114 
00116         bool _checkFBOStatus();
00117     };
00118 }
00119 
00120 
00121 #endif //EQ_FRAMEBUFFEROBJECT_H 
Generated on Mon Aug 10 18:58:32 2009 for Equalizer 0.9 by  doxygen 1.5.8