20 #ifndef EQUTIL_TEXTURE_H
21 #define EQUTIL_TEXTURE_H
24 #include <lunchbox/thread.h>
30 namespace detail {
class Texture; }
49 EQ_API
Texture(
const unsigned target,
50 const GLEWContext*
const glewContext = 0 );
64 uint32_t getCompressorTarget()
const;
81 const uint32_t type );
93 EQ_API
unsigned getType()
const;
96 EQ_API
unsigned getName()
const;
118 EQ_API
void init(
const unsigned internalFormat,
const int32_t width,
119 const int32_t height );
128 EQ_API
void applyZoomFilter(
const ZoomFilter filter )
const;
130 EQ_API
void applyWrap()
const;
141 EQ_API
void upload(
const int32_t width,
const int32_t height,
148 EQ_API
void download(
void* buffer )
const;
151 EQ_API
void bind()
const;
154 EQ_API
void bindToFBO(
const unsigned target,
const int32_t width,
155 const int32_t height,
const int32_t samples = 1 );
158 EQ_API
void resize(
const int32_t width,
const int32_t height );
161 EQ_API
void writeRGB(
const std::string& filename )
const;
164 EQ_API
const GLEWContext* glewGetContext()
const;
165 EQ_API
void setGLEWContext(
const GLEWContext* context );
188 EQ_API
void setGLData(
const unsigned id,
const unsigned internalFormat,
189 const int32_t width,
const int32_t height );
193 Texture(
const Texture& ) =
delete;
194 Texture& operator=(
const Texture& ) =
delete;
195 detail::Texture*
const _impl;
205 void _setInternalFormat(
const unsigned internalFormat );
211 void _grow(
const int32_t width,
const int32_t height );
213 LB_TS_VAR( _thread );
221 #endif // EQUTIL_TEXTURE_H
EQ_API bool isValid() const
EQ_API void setExternalFormat(const uint32_t format, const uint32_t type)
Set the external data format and type.
EQ_API void bind() const
Bind the texture.
A wrapper around OpenGL textures.
EQ_API void download(void *buffer) const
Copy the texture data from the GPU to the given memory address.
EQ_API unsigned getInternalFormat() const
ZoomFilter
Filtering algorithm to applied during zoom operations.
EQ_API void upload(const int32_t width, const int32_t height, const void *ptr)
Copy the specified buffer to the texture at 0,0.
EQ_API void flush()
Clear the texture, including deleting the GL texture name.
EQ_API void init(const unsigned internalFormat, const int32_t width, const int32_t height)
Initialize an OpenGL texture.
EQ_API std::ostream & operator<<(std::ostream &, const Texture &)
Print the texture state to the given output stream.
EQ_API void writeRGB(const std::string &filename) const
Write the texture data as an rgb image file.
EQ_API void setGLData(const unsigned id, const unsigned internalFormat, const int32_t width, const int32_t height)
Use an OpenGL texture created externally.
EQ_API unsigned getFormat() const
EQ_API int32_t getWidth() const
EQ_API int32_t getHeight() const
EQ_API unsigned getTarget() const
EQ_API void copyFromFrameBuffer(const unsigned internalFormat, const fabric::PixelViewport &pvp)
Copy the specified area from the current read buffer to the texture at 0,0.
EQ_API unsigned getName() const
virtual EQ_API ~Texture()
Destruct the texture.
Holds a 2D pixel viewport with methods for manipulation.
EQ_API Texture(const unsigned target, const GLEWContext *const glewContext=0)
Construct a new Texture.
EQ_API void bindToFBO(const unsigned target, const int32_t width, const int32_t height, const int32_t samples=1)
Create and bind a texture to the current FBO.
EQ_API void resize(const int32_t width, const int32_t height)
Resize the texture.
EQ_API unsigned getType() const
EQ_API void flushNoDelete()
Flush the texture without deleting the GL texture name.