OpenGL::IoTextureSet Class Reference

#include <IoTextureSet.h>

Inheritance diagram for OpenGL::IoTextureSet:

OpenGL::Flat3dTextureSet List of all members.

Public Member Functions

 IoTextureSet (unsigned int width, unsigned int height, GLenum target, GLint internalFormat)
 IoTextureSet (std::pair< unsigned int, unsigned int > dimensions, GLenum target, GLint internalFormat)
unsigned int addPrimaryTexture (const std::string &description)
unsigned int addSecondaryTexture (unsigned int width, unsigned int height, GLenum target, GLint internalFormat, const std::string &description)
unsigned int importSecondaryTexture (IoTextureSet *textureSet, unsigned int textureId, const std::string &description)
void resizeSecondaryTexture (unsigned int textureId, unsigned int width, unsigned int height)
void clearTexture (unsigned int textureId)
std::vector< Util::ColorgetTexture (unsigned int textureId)
void fillTexture (unsigned int textureId, GLenum format, GLenum type, const GLvoid *pixels)
void swap ()
void setActiveTexture (unsigned int textureId, bool swap=false)
GLuint lookup (unsigned int textureId) const
unsigned int getPrimaryWidth () const
unsigned int getPrimaryHeight () const
GLenum getPrimaryTarget () const
GLint getPrimaryInternalFormat () const
unsigned int getWidth (unsigned int textureId) const
unsigned int getHeight (unsigned int textureId) const
GLenum getTarget (unsigned int textureId) const
GLint getInternalFormat (unsigned int textureId) const
std::string getDescription (unsigned int textureId) const
std::vector< unsigned int > getPrimaryTextures () const
std::vector< unsigned int > getSecondaryTextures () const
unsigned int getPrimaryTextureCount () const
unsigned int getSecondaryTextureCount () const

Static Public Member Functions

static void bindFbo ()
static void disableFbo ()

Detailed Description

IoTextureSet represents a set of textures which can be used as input or output by fragment operations. Each texture gets an associated texture identifier which is used to refer to it. Textures are used as output by enabling a framebuffer object and attaching the texture to it. Enabling and disabling the framebuffer object is done by the two static member functions bindFbo() and disableFbo() respectively, whereas textures are attached using the member function setActiveTexture(). Additionally, IoTextureSet offers member functions for accessing the texture data of the contained textures. The textures contained in an IoTextureSet instance are divided into secondary and primary textures. Primary textures all have the same dimensions and format, whereas the secondary texture can be of different dimensions and formats. Swapping (or ping-ponging) is supported by adding an additional temporary texture of the same dimensions and format as the primary textures. To swap the currently active texture with the temporary texture the member function swap() is used. Secondary textures are not supported for swapping, but can be imported from other IoTextureSet instances in order to share a texture between several instances.


Constructor & Destructor Documentation

OpenGL::IoTextureSet::IoTextureSet unsigned int  width,
unsigned int  height,
GLenum  target,
GLint  internalFormat
 

Default constructor.

Parameters:
width the primary texture width.
height the primary texture height.
target the OpenGL texture target.
internalFormat the texture internal format (number of channels etc).

OpenGL::IoTextureSet::IoTextureSet std::pair< unsigned int, unsigned int >  dimensions,
GLenum  target,
GLint  internalFormat
 

Constructor using dimensions.

Parameters:
dimensions the dimensions of the primary texture, where width = dimensions.first and height = dimensions.second.
target the OpenGL texture target.
internalFormat the texture internal format (number of channels etc).


Member Function Documentation

unsigned int OpenGL::IoTextureSet::addPrimaryTexture const std::string &  description  ) 
 

Adds a primary texture.

Parameters:
description a textual description of the contents of the texture.
Returns:
a texture identifier used for looking up the texture.

unsigned int OpenGL::IoTextureSet::addSecondaryTexture unsigned int  width,
unsigned int  height,
GLenum  target,
GLint  internalFormat,
const std::string &  description
 

Adds a secondary texture.

Parameters:
width the texture's width.
height the texture's height.
target the OpenGL texture target.
internalFormat the texture's internal format (number of channels etc).
description a textual description of the contents of the texture.
Returns:
a texture identifier used for looking up the texture.

void OpenGL::IoTextureSet::bindFbo  )  [static]
 

Binds the Frame Buffer Object. Results from the fragment shaders are written to the active texture (render target) instead of the frame buffer.

void OpenGL::IoTextureSet::clearTexture unsigned int  textureId  ) 
 

Clears a texture by setting all channel values to 0.

Parameters:
textureId the identifier of the texture to be cleared.

void OpenGL::IoTextureSet::disableFbo  )  [static]
 

Disables the Frame Buffer Object.

void OpenGL::IoTextureSet::fillTexture unsigned int  textureId,
GLenum  format,
GLenum  type,
const GLvoid *  pixels
 

Fills a texture with pixel values.

Parameters:
textureId the identifier of the texture to be filled.
format the format of pixel values (number of channels).
type the type of the pixel values.
pixels pointer to the pixel values.

std::string OpenGL::IoTextureSet::getDescription unsigned int  textureId  )  const
 

Returns the description of a given texture.

Parameters:
textureId the identifier of the texture.
Returns:
the description of the texture.

unsigned int OpenGL::IoTextureSet::getHeight unsigned int  textureId  )  const
 

Returns the height of a given texture.

Parameters:
textureId the identifier of the texture.
Returns:
the height of the texture.

GLint OpenGL::IoTextureSet::getInternalFormat unsigned int  textureId  )  const
 

Returns the internal format of a given texture.

Parameters:
textureId the identifier of the texture.
Returns:
the internal format of the texture.

unsigned int OpenGL::IoTextureSet::getPrimaryHeight  )  const
 

Returns the height of the primary textures.

Returns:
the height of the primary textures.

GLint OpenGL::IoTextureSet::getPrimaryInternalFormat  )  const
 

Returns the internal format of the primary textures.

Returns:
the internal format of the primary textures.

GLenum OpenGL::IoTextureSet::getPrimaryTarget  )  const
 

Returns the target of the primary textures.

Returns:
the target of the primary textures.

unsigned int OpenGL::IoTextureSet::getPrimaryTextureCount  )  const
 

Returns the number of primary textures.

Returns:
the number of primary textures.

std::vector< unsigned int > OpenGL::IoTextureSet::getPrimaryTextures  )  const
 

Returns the primary texture identifiers.

Returns:
the primary texture identifiers.

unsigned int OpenGL::IoTextureSet::getPrimaryWidth  )  const
 

Returns the width of the primary textures.

Returns:
the width of the primary textures.

unsigned int OpenGL::IoTextureSet::getSecondaryTextureCount  )  const
 

Returns the number of secondary textures.

Returns:
the number of secondary textures.

std::vector< unsigned int > OpenGL::IoTextureSet::getSecondaryTextures  )  const
 

Returns the secondary texture identifiers.

Returns:
the secondary texture identifiers.

GLenum OpenGL::IoTextureSet::getTarget unsigned int  textureId  )  const
 

Returns the target of a given texture.

Parameters:
textureId the identifier of the texture.
Returns:
the target of the texture.

std::vector< Util::Color > OpenGL::IoTextureSet::getTexture unsigned int  textureId  ) 
 

Gets the contents of a texture.

Parameters:
textureId the identifier of the texture.
Returns:
a vector containing the texture's contents.

unsigned int OpenGL::IoTextureSet::getWidth unsigned int  textureId  )  const
 

Returns the width of a given texture.

Parameters:
textureId the identifier of the texture.
Returns:
the width of the texture.

unsigned int OpenGL::IoTextureSet::importSecondaryTexture IoTextureSet textureSet,
unsigned int  textureId,
const std::string &  description
 

Imports a secondary texture from a primary or secondary texture in another texture set.

Parameters:
textureSet the texture set containing the texture.
textureId the identifier of the texture in the other texture set.
description a textual description of the contents of the texture.
Returns:
a texture identifier used for looking up the texture.

GLuint OpenGL::IoTextureSet::lookup unsigned int  textureId  )  const
 

Performs a lookup to retrieve the real GLuint texture.

Parameters:
textureId the identifier of the texture to be retrieved.
Returns:
the real GLuint texture.

void OpenGL::IoTextureSet::resizeSecondaryTexture unsigned int  textureId,
unsigned int  width,
unsigned int  height
 

Resizes a secondary texture owned by this IoTextureSet.

Parameters:
textureId the texture identifier of the texture to be resized.
width the new texture width.
height the new texture height.

void OpenGL::IoTextureSet::setActiveTexture unsigned int  textureId,
bool  swap = false
 

Sets a texture as the active texture on the Frame Buffer Object. The active texture is then the current render target.

Parameters:
textureId the identifier of the texture to be set active.
swap if swap is needed.

void OpenGL::IoTextureSet::swap  ) 
 

Swaps temporary texture with swap texture (active texture).


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 08:42:53 2006 for GPU Thesis by  doxygen 1.4.6-NO