Equalizer
2.0.0
Parallel Rendering Framework
|
A wrapper around OpenGL textures. More...
#include <texture.h>
Public Member Functions | |
EQ_API | Texture (const unsigned target, const GLEWContext *const glewContext=0) |
Construct a new Texture. More... | |
virtual EQ_API | ~Texture () |
Destruct the texture. More... | |
EQ_API const GLEWContext * | glewGetContext () const |
EQ_API void | setGLEWContext (const GLEWContext *context) |
Data Access. | |
EQ_API unsigned | getTarget () const |
uint32_t | getCompressorTarget () const |
EQ_API unsigned | getInternalFormat () const |
EQ_API void | setExternalFormat (const uint32_t format, const uint32_t type) |
Set the external data format and type. More... | |
EQ_API unsigned | getFormat () const |
EQ_API unsigned | getType () const |
EQ_API unsigned | getName () const |
EQ_API int32_t | getWidth () const |
EQ_API int32_t | getHeight () const |
EQ_API bool | isValid () const |
Operations. | |
EQ_API void | init (const unsigned internalFormat, const int32_t width, const int32_t height) |
Initialize an OpenGL texture. More... | |
EQ_API void | flush () |
Clear the texture, including deleting the GL texture name. More... | |
EQ_API void | applyZoomFilter (const ZoomFilter filter) const |
EQ_API void | applyWrap () 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. More... | |
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. More... | |
EQ_API void | download (void *buffer) const |
Copy the texture data from the GPU to the given memory address. More... | |
EQ_API void | bind () const |
Bind the texture. More... | |
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. More... | |
EQ_API void | resize (const int32_t width, const int32_t height) |
Resize the texture. More... | |
EQ_API void | writeRGB (const std::string &filename) const |
Write the texture data as an rgb image file. More... | |
Wrap existing GL textures | |
EQ_API void | flushNoDelete () |
Flush the texture without deleting the GL texture name. More... | |
EQ_API void | setGLData (const unsigned id, const unsigned internalFormat, const int32_t width, const int32_t height) |
Use an OpenGL texture created externally. More... | |
A wrapper around OpenGL textures.
So far used by the Image and Compositor. The target is assumed to be GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_2D.
EQ_API eq::util::Texture::Texture | ( | const unsigned | target, |
const GLEWContext *const | glewContext = 0 |
||
) |
Construct a new Texture.
A GLEWContext might be provided later using setGLEWContext(). It is needed for operations using OpenGL extensions or version 1.2 or later functions.
|
virtual |
Destruct the texture.
EQ_API void eq::util::Texture::bind | ( | ) | const |
Bind the texture.
EQ_API void eq::util::Texture::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 eq::util::Texture::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 void eq::util::Texture::download | ( | void * | buffer | ) | const |
Copy the texture data from the GPU to the given memory address.
EQ_API void eq::util::Texture::flush | ( | ) |
Clear the texture, including deleting the GL texture name.
EQ_API void eq::util::Texture::flushNoDelete | ( | ) |
Flush the texture without deleting the GL texture name.
EQ_API unsigned eq::util::Texture::getFormat | ( | ) | const |
EQ_API int32_t eq::util::Texture::getHeight | ( | ) | const |
EQ_API unsigned eq::util::Texture::getInternalFormat | ( | ) | const |
EQ_API unsigned eq::util::Texture::getName | ( | ) | const |
EQ_API unsigned eq::util::Texture::getTarget | ( | ) | const |
EQ_API unsigned eq::util::Texture::getType | ( | ) | const |
EQ_API int32_t eq::util::Texture::getWidth | ( | ) | const |
EQ_API void eq::util::Texture::init | ( | const unsigned | internalFormat, |
const int32_t | width, | ||
const int32_t | height | ||
) |
Initialize an OpenGL texture.
internalFormat | the OpenGL texture internal format. |
width | the width of the texture. |
height | the height of the texture. |
EQ_API bool eq::util::Texture::isValid | ( | ) | const |
EQ_API void eq::util::Texture::resize | ( | const int32_t | width, |
const int32_t | height | ||
) |
Resize the texture.
EQ_API void eq::util::Texture::setExternalFormat | ( | const uint32_t | format, |
const uint32_t | type | ||
) |
Set the external data format and type.
format | the OpenGL format. |
type | the OpenGL Type. |
EQ_API void eq::util::Texture::setGLData | ( | const unsigned | id, |
const unsigned | internalFormat, | ||
const int32_t | width, | ||
const int32_t | height | ||
) |
Use an OpenGL texture created externally.
The previous GL texture, if any, is deallocated using flush(). The new texture has to be of the correct target, size and internal format. The texture is validated by this method.
id | The OpenGL texture name. |
internalFormat | the OpenGL texture internal format. |
width | the width of the texture. |
height | the height of the texture. |
EQ_API void eq::util::Texture::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 eq::util::Texture::writeRGB | ( | const std::string & | filename | ) | const |
Write the texture data as an rgb image file.