Equalizer  1.4.1
texture.h
00001 
00002 /* Copyright (c) 2009-2012, Stefan Eilemann <eile@equalizergraphics.com>
00003  *                    2010, Cedric Stalder <cedric.stalder@gmail.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_TEXTURE_H
00020 #define EQUTIL_TEXTURE_H
00021 
00022 #include <eq/client/frame.h>        // Frame::Buffer enum
00023 
00024 #include <lunchbox/thread.h>         // thread debug macro
00025 #include <lunchbox/nonCopyable.h>    // base class
00026 
00027 namespace eq
00028 {
00029 namespace util
00030 {
00031 namespace detail { class Texture; }
00038     class Texture : public lunchbox::NonCopyable
00039     {
00040     public:
00049         EQ_API Texture( const unsigned target,
00050                         const GLEWContext* const glewContext = 0 );
00051 
00053         EQ_API virtual ~Texture();
00054 
00058         EQ_API unsigned getTarget() const;
00059 
00064         uint32_t getCompressorTarget() const;
00065 
00071         EQ_API unsigned getInternalFormat() const;
00072 
00080         EQ_API void setExternalFormat( const uint32_t format,
00081                                        const uint32_t type );
00082 
00087         EQ_API unsigned getFormat() const;
00088 
00093         EQ_API unsigned getType() const;
00094 
00096         EQ_API unsigned getName() const;
00097 
00099         EQ_API int32_t getWidth() const;
00100 
00102         EQ_API int32_t getHeight() const;
00103 
00105         EQ_API bool isValid() const;
00107 
00118         EQ_API void init( const unsigned internalFormat, const int32_t width,
00119                           const int32_t height );
00120 
00125         EQ_API void flush();
00126 
00128         void applyZoomFilter( const ZoomFilter filter ) const;
00129 
00130         void applyWrap() const; //<! @internal
00131 
00137         EQ_API void copyFromFrameBuffer( const unsigned internalFormat,
00138                                          const fabric::PixelViewport& pvp );
00139 
00141         EQ_API void upload( const int32_t width, const int32_t height,
00142                             const void* ptr );
00143 
00148         EQ_API void download( void* buffer ) const;
00149 
00151         EQ_API void bind() const;
00152 
00154         EQ_API void bindToFBO( const unsigned target, const int32_t width,
00155                                   const int32_t height );
00156         
00158         EQ_API void resize( const int32_t width, const int32_t height );
00159 
00161         EQ_API void writeRGB( const std::string& filename ) const;
00163 
00164         EQ_API const GLEWContext* glewGetContext() const;
00165         EQ_API void setGLEWContext( const GLEWContext* context );
00166 
00173         EQ_API void flushNoDelete();
00174 
00188         EQ_API void setGLData( const unsigned id, const unsigned internalFormat,
00189                                const int32_t width, const int32_t height );
00191 
00192     private:
00193         detail::Texture* const _impl;
00194 
00203         void _setInternalFormat( const unsigned internalFormat );
00204 
00206         void _generate();
00207         
00209         void _grow( const int32_t width, const int32_t height );
00210 
00211         LB_TS_VAR( _thread );
00212     };
00213 }
00214 }
00215 
00216 #endif // EQUTIL_TEXTURE_H
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1