Equalizer 1.0
|
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/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, 00074 const int32_t depthSize, 00075 const int32_t stencilSize ); 00076 00078 EQ_API void exit(); 00079 00088 EQ_API void bind(); 00089 00095 EQ_API void unbind(); 00096 00107 EQ_API bool resize( const int32_t width, const int32_t height ); 00108 00110 int32_t getWidth() const 00111 { EQASSERT( !_colors.empty( )); return _colors.front()->getWidth();} 00112 00114 int32_t getHeight() const 00115 { EQASSERT( !_colors.empty()); return _colors.front()->getHeight();} 00116 00118 const Textures& getColorTextures() const { return _colors; } 00119 00121 const Texture& getDepthTexture() const { return _depth; } 00122 00124 const co::base::Error& getError() { return _error; } 00125 00127 const GLEWContext* glewGetContext() const { return _glewContext; } 00128 00130 bool isValid() const { return _valid; } 00131 00132 private: 00133 GLuint _fboID; 00134 00135 Textures _colors; 00136 Texture _depth; 00137 00138 const GLEWContext* const _glewContext; 00139 00141 co::base::Error _error; 00142 00143 bool _valid; 00144 00145 struct Private; 00146 Private* _private; // placeholder for binary-compatible changes 00147 00148 EQ_TS_VAR( _thread ); 00149 00151 bool _checkStatus(); 00152 00153 void _setError( const int32_t error ); 00154 }; 00155 } 00156 } 00157 00158 #endif // EQUTIL_FRAMEBUFFEROBJECT_H