Equalizer  2.1.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
31 {
32 class Texture;
33 }
34 
41 class Texture
42 {
43 public:
52  EQ_API Texture(const unsigned target,
53  const GLEWContext* const glewContext = 0);
54 
56  EQ_API virtual ~Texture();
57 
61  EQ_API unsigned getTarget() const;
62 
67  uint32_t getCompressorTarget() const;
68 
74  EQ_API unsigned getInternalFormat() const;
75 
83  EQ_API void setExternalFormat(const uint32_t format, const uint32_t type);
84 
89  EQ_API unsigned getFormat() const;
90 
95  EQ_API unsigned getType() const;
96 
98  EQ_API unsigned getName() const;
99 
101  EQ_API int32_t getWidth() const;
102 
104  EQ_API int32_t getHeight() const;
105 
107  EQ_API bool isValid() const;
109 
120  EQ_API void init(const unsigned internalFormat, const int32_t width,
121  const int32_t height);
122 
127  EQ_API void flush();
128 
130  EQ_API void applyZoomFilter(const ZoomFilter filter) const;
131 
132  EQ_API void applyWrap() const; //<! @internal
133 
139  EQ_API void copyFromFrameBuffer(const unsigned internalFormat,
140  const fabric::PixelViewport& pvp);
141 
143  EQ_API void upload(const int32_t width, const int32_t height,
144  const void* ptr);
145 
150  EQ_API void download(void* buffer) const;
151 
153  EQ_API void bind() const;
154 
156  EQ_API void bindToFBO(const unsigned target, const int32_t width,
157  const int32_t height, const int32_t samples = 1);
158 
160  EQ_API void resize(const int32_t width, const int32_t height);
161 
163  EQ_API void writeRGB(const std::string& filename) const;
165 
166  EQ_API const GLEWContext* glewGetContext() const;
167  EQ_API void setGLEWContext(const GLEWContext* context);
168 
175  EQ_API void flushNoDelete();
176 
190  EQ_API void setGLData(const unsigned id, const unsigned internalFormat,
191  const int32_t width, const int32_t height);
193 
194 private:
195  Texture(const Texture&) = delete;
196  Texture& operator=(const Texture&) = delete;
197  detail::Texture* const _impl;
198 
207  void _setInternalFormat(const unsigned internalFormat);
208 
210  void _generate();
211 
213  void _grow(const int32_t width, const int32_t height);
214 
215  LB_TS_VAR(_thread);
216 };
218 EQ_API std::ostream& operator<<(std::ostream&, const Texture&);
219 }
220 }
221 
222 #endif // EQUTIL_TEXTURE_H
A wrapper around OpenGL textures.
Definition: texture.h:41
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