Equalizer 1.0
|
A wrapper around OpenGL textures. More...
#include <texture.h>
Public Member Functions | |
Texture (const GLenum target, const GLEWContext *const glewContext=0) | |
Construct a new Texture. | |
virtual | ~Texture () |
Destruct the texture. | |
const GLEWContext * | glewGetContext () const |
void | setGLEWContext (const GLEWContext *context) |
Data Access. | |
GLenum | getTarget () const |
uint32_t | getCompressorTarget () const |
GLuint | getInternalFormat () const |
void | setExternalFormat (const uint32_t format, const uint32_t type) |
Set the external data format and type. | |
GLuint | getFormat () const |
GLuint | getType () const |
GLuint | getName () const |
int32_t | getWidth () const |
int32_t | getHeight () const |
bool | isValid () const |
Operations. | |
void | init (const GLuint internalFormat, const int32_t width, const int32_t height) |
Initialize an OpenGL texture. | |
void | flush () |
Clear the texture, including deleting the GL texture name. | |
void | applyZoomFilter (const ZoomFilter filter) const |
void | applyWrap () const |
void | copyFromFrameBuffer (const GLuint internalFormat, const fabric::PixelViewport &pvp) |
Copy the specified area from the current read buffer to the texture at 0,0. | |
void | upload (const int32_t width, const int32_t height, const void *ptr) |
Copy the specified buffer to the texture at 0,0. | |
void | download (void *buffer) const |
Copy the texture data from the GPU to the given memory address. | |
void | bind () const |
Bind the texture. | |
void | bindToFBO (const GLenum target, const int32_t width, const int32_t height) |
Create and bind a texture to the current FBO. | |
void | resize (const int32_t width, const int32_t height) |
Resize the texture. | |
void | writeRGB (const std::string &filename) const |
Write the texture data as an rgb image file. | |
Wrap existing GL textures | |
void | flushNoDelete () |
Flush the texture without deleting the GL texture name. | |
void | setGLData (const GLuint id, const GLuint internalFormat, const int32_t width, const int32_t height) |
Use an OpenGL texture created externally. |
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::util::Texture::Texture | ( | const GLenum | 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 eq::util::Texture::~Texture | ( | ) | [virtual] |
Destruct the texture.
void eq::util::Texture::bind | ( | ) | const |
Bind the texture.
Referenced by eVolve::Channel::frameViewFinish().
void eq::util::Texture::bindToFBO | ( | const GLenum | target, |
const int32_t | width, | ||
const int32_t | height | ||
) |
Create and bind a texture to the current FBO.
void eq::util::Texture::copyFromFrameBuffer | ( | const GLuint | internalFormat, |
const fabric::PixelViewport & | pvp | ||
) |
Copy the specified area from the current read buffer to the texture at 0,0.
void eq::util::Texture::download | ( | void * | buffer | ) | const |
Copy the texture data from the GPU to the given memory address.
void eq::util::Texture::flush | ( | ) |
Clear the texture, including deleting the GL texture name.
void eq::util::Texture::flushNoDelete | ( | ) |
Flush the texture without deleting the GL texture name.
GLuint eq::util::Texture::getFormat | ( | ) | const [inline] |
int32_t eq::util::Texture::getHeight | ( | ) | const [inline] |
Definition at line 104 of file texture.h.
Referenced by eVolve::Channel::frameViewFinish().
GLuint eq::util::Texture::getInternalFormat | ( | ) | const [inline] |
GLuint eq::util::Texture::getName | ( | ) | const [inline] |
GLenum eq::util::Texture::getTarget | ( | ) | const [inline] |
Definition at line 60 of file texture.h.
Referenced by eVolve::Channel::frameViewFinish().
GLuint eq::util::Texture::getType | ( | ) | const [inline] |
int32_t eq::util::Texture::getWidth | ( | ) | const [inline] |
Definition at line 101 of file texture.h.
Referenced by eVolve::Channel::frameViewFinish().
void eq::util::Texture::init | ( | const GLuint | 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. |
bool eq::util::Texture::isValid | ( | ) | const |
void eq::util::Texture::resize | ( | const int32_t | width, |
const int32_t | height | ||
) |
Resize the texture.
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. |
void eq::util::Texture::setGLData | ( | const GLuint | id, |
const GLuint | 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. |
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.
void eq::util::Texture::writeRGB | ( | const std::string & | filename | ) | const |
Write the texture data as an rgb image file.