Cinder  0.9.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cinder::gl::TextureCubeMap Class Reference

#include <Texture.h>

Inherits cinder::gl::TextureBase.

Classes

struct  Format
 

Public Member Functions

GLint getWidth () const override
 
GLint getHeight () const override
 
GLint getDepth () const override
 
void replace (const TextureData &textureData)
 
void setDoNotDispose (bool aDoNotDispose=true)
 
GLint getInternalFormat () const
 
GLuint getId () const
 
GLenum getTarget () const
 
void bind (uint8_t textureUnit=0) const
 
void unbind (uint8_t textureUnit=0) const
 
float getAspectRatio () const
 
Area getBounds () const
 
bool hasAlpha () const
 
void setWrap (GLenum wrapS, GLenum wrapT)
 
void setWrap (GLenum wrapS, GLenum wrapT, GLenum wrapR)
 
void setWrapS (GLenum wrapS)
 
void setWrapT (GLenum wrapT)
 
void setWrapR (GLenum wrapR)
 
void setMinFilter (GLenum minFilter)
 
void setMagFilter (GLenum magFilter)
 
void setMaxAnisotropy (GLfloat maxAnisotropy)
 
bool hasMipmapping () const
 
void setCompareMode (GLenum compareMode)
 
void setCompareFunc (GLenum compareFunc)
 
std::array< GLint, 4 > getSwizzleMask () const
 
const std::string & getLabel () const
 
void setLabel (const std::string &label)
 

Static Public Member Functions

static TextureCubeMapRef create (int32_t width, int32_t height, const Format &format=Format())
 
static TextureCubeMapRef create (const ImageSourceRef &imageSource, const Format &format=Format())
 
static TextureCubeMapRef create (const ImageSourceRef images[6], const Format &format=Format())
 
static TextureCubeMapRef create (const TextureData &data, const Format &format)
 
static TextureCubeMapRef createFromKtx (const DataSourceRef &dataSource, const Format &format=Format())
 
static TextureCubeMapRef createFromDds (const DataSourceRef &dataSource, const Format &format=Format())
 
static GLenum getBindingConstantForTarget (GLenum target)
 
static void getInternalFormatInfo (GLint internalFormat, GLenum *outDataFormat, GLenum *outDataType, bool *outAlpha=nullptr, bool *outCompressed=nullptr, bool *outSrgb=nullptr)
 
static int requiredMipLevels (GLint width, GLint height, GLint depth)
 
template<typename T >
static bool surfaceRequiresIntermediate (int32_t width, uint8_t pixelBytes, int32_t rowBytes, SurfaceChannelOrder surfaceChannelOrder)
 
template<typename T >
static void SurfaceChannelOrderToDataFormatAndType (const SurfaceChannelOrder &sco, GLint *dataFormat, GLenum *type)
 
static ivec2 calcMipLevelSize (int level, GLint width, GLint height)
 
static GLfloat getMaxAnisotropyMax ()
 
static bool supportsHardwareSwizzle ()
 

Protected Member Functions

 TextureCubeMap (int32_t width, int32_t height, Format format)
 
template<typename T >
 TextureCubeMap (const SurfaceT< T > images[6], Format format)
 
 TextureCubeMap (const TextureData &data, Format format)
 
void printDims (std::ostream &os) const override
 
void initParams (Format &format, GLint defaultInternalFormat, GLint defaultDataType)
 

Static Protected Member Functions

template<typename T >
static TextureCubeMapRef createTextureCubeMapImpl (const ImageSourceRef &imageSource, const Format &format)
 

Protected Attributes

GLint mWidth
 
GLint mHeight
 
GLenum mTarget
 
GLuint mTextureId
 
GLint mInternalFormat
 
bool mMipmapping
 
GLint mBaseMipmapLevel
 
GLint mMaxMipmapLevel
 
bool mDoNotDispose
 
std::array< GLint, 4 > mSwizzleMask
 
std::string mLabel
 

Constructor & Destructor Documentation

cinder::gl::TextureCubeMap::TextureCubeMap ( int32_t  width,
int32_t  height,
Format  format 
)
protected
template<typename T >
cinder::gl::TextureCubeMap::TextureCubeMap ( const SurfaceT< T >  images[6],
Format  format 
)
protected
cinder::gl::TextureCubeMap::TextureCubeMap ( const TextureData data,
Format  format 
)
protected

Member Function Documentation

TextureCubeMapRef cinder::gl::TextureCubeMap::create ( int32_t  width,
int32_t  height,
const Format format = Format() 
)
static
TextureCubeMapRef cinder::gl::TextureCubeMap::create ( const ImageSourceRef imageSource,
const Format format = Format() 
)
static

Automatically infers Horizontal Cross, Vertical Cross, Row, or Column based on image aspect ratio.

TextureCubeMapRef cinder::gl::TextureCubeMap::create ( const ImageSourceRef  images[6],
const Format format = Format() 
)
static

Expects images ordered { +X, -X, +Y, -Y, +Z, -Z }.

TextureCubeMapRef cinder::gl::TextureCubeMap::create ( const TextureData data,
const Format format 
)
static

Constructs a TextureCubeMap based on an instance of TextureData.

TextureCubeMapRef cinder::gl::TextureCubeMap::createFromKtx ( const DataSourceRef dataSource,
const Format format = Format() 
)
static

Constructs a TextureCubeMap from a KTX file. Enables mipmapping if KTX file contains mipmaps and Format has not specified false for mipmapping. Uses Format's intermediate PBO if supplied; requires it to be large enough to hold all MIP levels and throws if it is not. (http://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/)

TextureCubeMapRef cinder::gl::TextureCubeMap::createFromDds ( const DataSourceRef dataSource,
const Format format = Format() 
)
static

Constructs a TextureCubeMap from a DDS file. Supports DXT1, DTX3, and DTX5. Supports BC7 in the presence of GL_ARB_texture_compression_bptc. Enables mipmapping if DDS contains mipmaps and Format has not specified false for mipmapping. ANGLE version requires textures to be a multiple of 4 due to DX limitation.

GLint cinder::gl::TextureCubeMap::getWidth ( ) const
overridevirtual

Returns the width of the texture in pixels.

Implements cinder::gl::TextureBase.

GLint cinder::gl::TextureCubeMap::getHeight ( ) const
overridevirtual

Returns the height of the texture in pixels.

Implements cinder::gl::TextureBase.

GLint cinder::gl::TextureCubeMap::getDepth ( ) const
overridevirtual

Returns the depth of the texture in pixels (.

Implements cinder::gl::TextureBase.

void cinder::gl::TextureCubeMap::replace ( const TextureData textureData)

Replaces the pixels (and data store) of a Texture with contents of textureData.

template<typename T >
TextureCubeMapRef cinder::gl::TextureCubeMap::createTextureCubeMapImpl ( const ImageSourceRef imageSource,
const Format format 
)
staticprotected
void cinder::gl::TextureCubeMap::printDims ( std::ostream &  os) const
overrideprotectedvirtual
void cinder::gl::TextureBase::setDoNotDispose ( bool  aDoNotDispose = true)
inherited

Determines whether the Texture will call glDeleteTextures() to free the associated texture objects on destruction.

GLint cinder::gl::TextureBase::getInternalFormat ( ) const
inherited

the Texture's internal format, which is the format that OpenGL stores the texture data in memory. Common values include GL_RGB, GL_RGBA and GL_LUMINANCE

GLuint cinder::gl::TextureBase::getId ( ) const
inherited

the ID number for the texture, appropriate to pass to calls like glBindTexture()

GLenum cinder::gl::TextureBase::getTarget ( ) const
inherited

the target associated with texture. Typical values are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB

void cinder::gl::TextureBase::bind ( uint8_t  textureUnit = 0) const
inherited

Binds the Texture's texture to its target in the multitexturing unit GL_TEXTURE0 + textureUnit.

void cinder::gl::TextureBase::unbind ( uint8_t  textureUnit = 0) const
inherited

Unbinds the Texture currently bound in the Texture's target.

float cinder::gl::TextureBase::getAspectRatio ( ) const
inherited

Returns the 2D aspect ratio of the texture (width / height), ignoring clean bounds.

Area cinder::gl::TextureBase::getBounds ( ) const
inherited

Returns the Area defining the Texture's bounds in pixels, ignoring clean bounds.

bool cinder::gl::TextureBase::hasAlpha ( ) const
inherited

Returns whether the Texture has an alpha channel based on its internal format.

void cinder::gl::TextureBase::setWrap ( GLenum  wrapS,
GLenum  wrapT 
)
inherited

Sets the wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are GL_REPEAT, GL_CLAMP_TO_EDGE, etc. Default is GL_CLAMP_TO_EDGE.

void cinder::gl::TextureBase::setWrap ( GLenum  wrapS,
GLenum  wrapT,
GLenum  wrapR 
)
inherited

Sets the wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are GL_REPEAT, GL_CLAMP_TO_EDGE, etc. Default is GL_CLAMP_TO_EDGE.

void cinder::gl::TextureBase::setWrapS ( GLenum  wrapS)
inherited

Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are GL_REPEAT and GL_CLAMP_TO_EDGE, etc. Default is GL_CLAMP_TO_EDGE.

void cinder::gl::TextureBase::setWrapT ( GLenum  wrapT)
inherited

Sets the vertical wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are GL_REPEAT, GL_CLAMP_TO_EDGE, etc. Default is GL_CLAMP_TO_EDGE.

void cinder::gl::TextureBase::setWrapR ( GLenum  wrapR)
inherited

Sets the depth wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are GL_REPEAT, GL_CLAMP_TO_EDGE, etc. Default is GL_CLAMP_TO_EDGE.

void cinder::gl::TextureBase::setMinFilter ( GLenum  minFilter)
inherited

Sets the filtering behavior when a texture is displayed at a lower resolution than its native resolution. Possible values are.

  • GL_NEAREST
  • GL_LINEAR
  • GL_NEAREST_MIPMAP_NEAREST
  • GL_LINEAR_MIPMAP_NEAREST
  • GL_NEAREST_MIPMAP_LINEAR
  • GL_LINEAR_MIPMAP_LINEAR
void cinder::gl::TextureBase::setMagFilter ( GLenum  magFilter)
inherited

Sets the filtering behavior when a texture is displayed at a higher resolution than its native resolution. Possible values are

  • GL_NEAREST
  • GL_LINEAR
void cinder::gl::TextureBase::setMaxAnisotropy ( GLfloat  maxAnisotropy)
inherited

Sets the anisotropic filtering amount. A value greater than 1.0 "enables" anisotropic filtering. Maximum of getMaxAnisotropyMax();.

bool cinder::gl::TextureBase::hasMipmapping ( ) const
inherited

Returns whether the Texture has Mipmapping enabled.

void cinder::gl::TextureBase::setCompareMode ( GLenum  compareMode)
inherited
void cinder::gl::TextureBase::setCompareFunc ( GLenum  compareFunc)
inherited
GLenum cinder::gl::TextureBase::getBindingConstantForTarget ( GLenum  target)
staticinherited

Returns the appropriate parameter to glGetIntegerv() for a specific target; ie GL_TEXTURE_2D -> GL_TEXTURE_BINDING_2D. Returns 0 on failure.

void cinder::gl::TextureBase::getInternalFormatInfo ( GLint  internalFormat,
GLenum *  outDataFormat,
GLenum *  outDataType,
bool *  outAlpha = nullptr,
bool *  outCompressed = nullptr,
bool *  outSrgb = nullptr 
)
staticinherited

Returns the corresponding legal values for glTexImage*D() calls for dataFormat and dataType based on internalFormat, as well as whether the internal format contains an alpha channel, is compressed, and is in the sRGB color space.

int cinder::gl::TextureBase::requiredMipLevels ( GLint  width,
GLint  height,
GLint  depth 
)
staticinherited

Returns the number of mip levels necessary to represent a texture of width, height and depth.

template<typename T >
bool cinder::gl::TextureBase::surfaceRequiresIntermediate ( int32_t  width,
uint8_t  pixelBytes,
int32_t  rowBytes,
SurfaceChannelOrder  surfaceChannelOrder 
)
staticinherited

Returns whether a Surface of width, rowBytes and surfaceChannelOrder would require an intermediate Surface in order to be copied into a GL Texture.

template<typename T >
void cinder::gl::TextureBase::SurfaceChannelOrderToDataFormatAndType ( const SurfaceChannelOrder sco,
GLint *  dataFormat,
GLenum *  type 
)
staticinherited

Converts a SurfaceChannelOrder into an appropriate OpenGL dataFormat and type.

ivec2 cinder::gl::TextureBase::calcMipLevelSize ( int  level,
GLint  width,
GLint  height 
)
staticinherited

calculate the size of mipMap for the corresponding level

GLfloat cinder::gl::TextureBase::getMaxAnisotropyMax ( )
staticinherited

Returns the maximum anisotropic filtering maximum allowed by the hardware.

std::array<GLint,4> cinder::gl::TextureBase::getSwizzleMask ( ) const
inherited

Returns the Texture's swizzle mask (corresponding to GL_TEXTURE_SWIZZLE_RGBA)

bool cinder::gl::TextureBase::supportsHardwareSwizzle ( )
staticinherited

Returns whether this hardware supports texture swizzling (via GL_TEXTURE_SWIZZLE_RGBA)

const std::string& cinder::gl::TextureBase::getLabel ( ) const
inherited

Returns the debugging label associated with the Texture.

void cinder::gl::TextureBase::setLabel ( const std::string &  label)
inherited

Sets the debugging label associated with the Texture. Calls glObjectLabel() when available.

void cinder::gl::TextureBase::initParams ( Format format,
GLint  defaultInternalFormat,
GLint  defaultDataType 
)
protectedinherited

Member Data Documentation

GLint cinder::gl::TextureCubeMap::mWidth
protected
GLint cinder::gl::TextureCubeMap::mHeight
protected
GLenum cinder::gl::TextureBase::mTarget
protectedinherited
GLuint cinder::gl::TextureBase::mTextureId
protectedinherited
GLint cinder::gl::TextureBase::mInternalFormat
mutableprotectedinherited
bool cinder::gl::TextureBase::mMipmapping
protectedinherited
GLint cinder::gl::TextureBase::mBaseMipmapLevel
protectedinherited
GLint cinder::gl::TextureBase::mMaxMipmapLevel
protectedinherited
bool cinder::gl::TextureBase::mDoNotDispose
protectedinherited
std::array<GLint,4> cinder::gl::TextureBase::mSwizzleMask
protectedinherited
std::string cinder::gl::TextureBase::mLabel
protectedinherited

The documentation for this class was generated from the following files: