Equalizer  2.0.0
Parallel Rendering Framework
texture.h
1 
2 /* Copyright (c) 2009-2015, Stefan Eilemann <eile@equalizergraphics.com>
3  * Cedric Stalder <cedric.stalder@gmail.com>
4  * Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQUTIL_TEXTURE_H
21 #define EQUTIL_TEXTURE_H
22 
23 #include <eq/frame.h> // Frame::Buffer enum
24 #include <lunchbox/thread.h> // thread debug macro
25 
26 namespace eq
27 {
28 namespace util
29 {
30 namespace detail { class Texture; }
31 
38 class Texture
39 {
40 public:
49  EQ_API Texture( const unsigned target,
50  const GLEWContext* const glewContext = 0 );
51 
53  EQ_API virtual ~Texture();
54 
58  EQ_API unsigned getTarget() const;
59 
64  uint32_t getCompressorTarget() const;
65 
71  EQ_API unsigned getInternalFormat() const;
72 
80  EQ_API void setExternalFormat( const uint32_t format,
81  const uint32_t type );
82 
87  EQ_API unsigned getFormat() const;
88 
93  EQ_API unsigned getType() const;
94 
96  EQ_API unsigned getName() const;
97 
99  EQ_API int32_t getWidth() const;
100 
102  EQ_API int32_t getHeight() const;
103 
105  EQ_API bool isValid() const;
107 
118  EQ_API void init( const unsigned internalFormat, const int32_t width,
119  const int32_t height );
120 
125  EQ_API void flush();
126 
128  EQ_API void applyZoomFilter( const ZoomFilter filter ) const;
129 
130  EQ_API void applyWrap() const; //<! @internal
131 
137  EQ_API void copyFromFrameBuffer( const unsigned internalFormat,
138  const fabric::PixelViewport& pvp );
139 
141  EQ_API void upload( const int32_t width, const int32_t height,
142  const void* ptr );
143 
148  EQ_API void download( void* buffer ) const;
149 
151  EQ_API void bind() const;
152 
154  EQ_API void bindToFBO( const unsigned target, const int32_t width,
155  const int32_t height, const int32_t samples = 1 );
156 
158  EQ_API void resize( const int32_t width, const int32_t height );
159 
161  EQ_API void writeRGB( const std::string& filename ) const;
163 
164  EQ_API const GLEWContext* glewGetContext() const;
165  EQ_API void setGLEWContext( const GLEWContext* context );
166 
173  EQ_API void flushNoDelete();
174 
188  EQ_API void setGLData( const unsigned id, const unsigned internalFormat,
189  const int32_t width, const int32_t height );
191 
192 private:
193  Texture( const Texture& ) = delete;
194  Texture& operator=( const Texture& ) = delete;
195  detail::Texture* const _impl;
196 
205  void _setInternalFormat( const unsigned internalFormat );
206 
208  void _generate();
209 
211  void _grow( const int32_t width, const int32_t height );
212 
213  LB_TS_VAR( _thread );
214 };
216 EQ_API std::ostream& operator << ( std::ostream&, const Texture& );
217 
218 }
219 }
220 
221 #endif // EQUTIL_TEXTURE_H
A wrapper around OpenGL textures.
Definition: texture.h:38
ZoomFilter
Filtering algorithm to applied during zoom operations.
Definition: zoomFilter.h:25
EQ_API std::ostream & operator<<(std::ostream &, const Texture &)
Print the texture state to the given output stream.
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: init.h:58
The Equalizer client library.
Definition: eq/agl/types.h:23
Holds a 2D pixel viewport with methods for manipulation.
Definition: pixelViewport.h:34