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

#include <Texture.h>

Inherits cinder::gl::TextureBase.

Classes

struct  Format
 

Public Member Functions

void setCleanBounds (const Area &cleanBounds)
 
void update (const void *data, GLenum dataFormat, GLenum dataType, int mipLevel, int width, int height, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Surface8u &surface, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Channel8u &channel, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Surface16u &surface, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Channel16u &channel, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Surface32f &surface, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const Channel32f &channel, int mipLevel=0, const ivec2 &destLowerLeftOffset=ivec2(0, 0))
 
void update (const TextureData &textureData)
 
void update (const PboRef &pbo, GLenum format, GLenum type, int mipLevel=0, size_t pboByteOffset=0)
 
void update (const PboRef &pbo, GLenum format, GLenum type, const Area &destArea, int mipLevel=0, size_t pboByteOffset=0)
 
void updateFromKtx (const DataSourceRef &dataSource, const PboRef &intermediatePbo=PboRef())
 
void updateFromDds (const DataSourceRef &dataSource, const PboRef &intermediatePbo=PboRef())
 
void replace (const TextureData &textureData)
 
GLint getWidth () const override
 
GLint getHeight () const override
 
GLint getDepth () const override
 
GLint getActualWidth () const
 
GLint getActualHeight () const
 
ivec2 getSize () const
 
Rectf getAreaTexCoords (const Area &area) const
 
bool isTopDown () const
 
void setTopDown (bool topDown=true)
 
ImageSourceRef createSource ()
 
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 Texture2dRef create (int width, int height, const Format &format=Format())
 
static Texture2dRef create (const void *data, GLenum dataFormat, int width, int height, const Format &format=Format())
 
static Texture2dRef create (const Surface8u &surface, const Format &format=Format())
 
static Texture2dRef create (const Channel8u &channel, const Format &format=Format())
 
static Texture2dRef create (const Surface16u &surface, const Format &format=Format())
 
static Texture2dRef create (const Channel16u &channel, const Format &format=Format())
 
static Texture2dRef create (const Surface32f &surface, const Format &format=Format())
 
static Texture2dRef create (const Channel32f &channel, const Format &format=Format())
 
static Texture2dRef create (ImageSourceRef imageSource, const Format &format=Format())
 
static Texture2dRef create (GLenum target, GLuint textureID, int width, int height, bool doNotDispose, const std::function< void(Texture2d *)> &deleter=std::function< void(Texture2d *)>())
 
static Texture2dRef create (const TextureData &data, const Format &format)
 
static Texture2dRef createFromKtx (const DataSourceRef &dataSource, const Format &format=Format())
 
static Texture2dRef 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

 Texture2d (int width, int height, Format format=Format())
 
 Texture2d (const void *data, GLenum dataFormat, int width, int height, Format format=Format())
 
 Texture2d (const Surface8u &surface, Format format=Format())
 
 Texture2d (const Surface16u &surface, Format format=Format())
 
 Texture2d (const Surface32f &surface, Format format=Format())
 
 Texture2d (const Channel8u &channel, Format format=Format())
 
 Texture2d (const Channel16u &channel, Format format=Format())
 
 Texture2d (const Channel32f &channel, Format format=Format())
 
 Texture2d (const ImageSourceRef &imageSource, Format format=Format())
 
 Texture2d (GLenum target, GLuint textureId, int width, int height, bool doNotDispose)
 
 Texture2d (const TextureData &data, Format format)
 
void printDims (std::ostream &os) const override
 
void initParams (Format &format, GLint defaultInternalFormat, GLint defaultDataType)
 
void initMaxMipmapLevel ()
 
template<typename T >
void setData (const SurfaceT< T > &surface, bool createStorage, int mipLevel, const ivec2 &offset)
 
template<typename T >
void setData (const ChannelT< T > &channel, bool createStorage, int mipLevel, const ivec2 &offset)
 
void initData (const void *data, GLenum dataFormat, const Format &format)
 
void initData (const ImageSourceRef &imageSource, const Format &format)
 
void initDataImageSourceWithPboImpl (const ImageSourceRef &imageSource, const Format &format, GLint dataFormat, GLint dataType, ImageIo::ChannelOrder channelOrder, bool isGray, const PboRef &pbo)
 
void initDataImageSourceImpl (const ImageSourceRef &imageSource, const Format &format, GLint dataFormat, GLint dataType, ImageIo::ChannelOrder channelOrder, bool isGray)
 
void initParams (Format &format, GLint defaultInternalFormat, GLint defaultDataType)
 

Protected Attributes

ivec2 mActualSize
 
Area mCleanBounds
 
bool mTopDown
 
GLenum mTarget
 
GLuint mTextureId
 
GLint mInternalFormat
 
bool mMipmapping
 
GLint mBaseMipmapLevel
 
GLint mMaxMipmapLevel
 
bool mDoNotDispose
 
std::array< GLint, 4 > mSwizzleMask
 
std::string mLabel
 

Friends

class Texture2dCache
 

Constructor & Destructor Documentation

cinder::gl::Texture2d::Texture2d ( int  width,
int  height,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const void *  data,
GLenum  dataFormat,
int  width,
int  height,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Surface8u surface,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Surface16u surface,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Surface32f surface,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Channel8u channel,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Channel16u channel,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const Channel32f channel,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( const ImageSourceRef imageSource,
Format  format = Format() 
)
protected
cinder::gl::Texture2d::Texture2d ( GLenum  target,
GLuint  textureId,
int  width,
int  height,
bool  doNotDispose 
)
protected
cinder::gl::Texture2d::Texture2d ( const TextureData data,
Format  format 
)
protected

Member Function Documentation

Texture2dRef cinder::gl::Texture2d::create ( int  width,
int  height,
const Format format = Format() 
)
static

Constructs a texture of size(width, height) and allocates storage.

Texture2dRef cinder::gl::Texture2d::create ( const void *  data,
GLenum  dataFormat,
int  width,
int  height,
const Format format = Format() 
)
static

Constructs a texture of size(width, height). Pixel data is provided by data in format dataFormat (Ex: GL_RGB, GL_RGBA). Use format.setDataType() to specify a dataType other than GL_UNSIGNED_CHAR. Ignores format.loadTopDown().

Texture2dRef cinder::gl::Texture2d::create ( const Surface8u surface,
const Format format = Format() 
)
static

Constructs a Texture based on the contents of surface.

Texture2dRef cinder::gl::Texture2d::create ( const Channel8u channel,
const Format format = Format() 
)
static

Constructs a Texture based on the contents of channel. Sets swizzle mask to {R,R,R,1} where supported unless otherwise specified in format.

Texture2dRef cinder::gl::Texture2d::create ( const Surface16u surface,
const Format format = Format() 
)
static

Constructs a Texture based on the contents of surface.

Texture2dRef cinder::gl::Texture2d::create ( const Channel16u channel,
const Format format = Format() 
)
static

Constructs a Texture based on the contents of channel. Sets swizzle mask to {R,R,R,1} where supported unless otherwise specified in format.

Texture2dRef cinder::gl::Texture2d::create ( const Surface32f surface,
const Format format = Format() 
)
static

Constructs a Texture based on the contents of surface.

Texture2dRef cinder::gl::Texture2d::create ( const Channel32f channel,
const Format format = Format() 
)
static

Constructs a texture based on the contents of channel. A default value of -1 for internalFormat chooses an appropriate internal format automatically.

Texture2dRef cinder::gl::Texture2d::create ( ImageSourceRef  imageSource,
const Format format = Format() 
)
static

Constructs a Texture based on imageSource. A default value of -1 for internalFormat chooses an appropriate internal format based on the contents of imageSource. Uses a Format's intermediate PBO when available, which is resized as necessary.

Texture2dRef cinder::gl::Texture2d::create ( GLenum  target,
GLuint  textureID,
int  width,
int  height,
bool  doNotDispose,
const std::function< void(Texture2d *)> &  deleter = std::function<void(Texture2d*)>() 
)
static

Constructs a Texture based on an externally initialized OpenGL texture. doNotDispose specifies whether the Texture is responsible for disposing of the associated OpenGL resource. Supports a custom deleter.

Texture2dRef cinder::gl::Texture2d::create ( const TextureData data,
const Format format 
)
static

Constructs a Texture based on an instance of TextureData.

Texture2dRef cinder::gl::Texture2d::createFromKtx ( const DataSourceRef dataSource,
const Format format = Format() 
)
static

Constructs a Texture from an optionally compressed 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/)

TextureRef cinder::gl::Texture2d::createFromDds ( const DataSourceRef dataSource,
const Format format = Format() 
)
static

Constructs a Texture 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.

void cinder::gl::Texture2d::setCleanBounds ( const Area cleanBounds)

Allows specification of some Area other than the Texture's full area for cases where not all pixels in the Texture are usable / "clean"; common in video decoding pipelines in particular. Specified in pixels, and relative to upper-left origin coordinate system regardless of whether Textre is top-down or not.

void cinder::gl::Texture2d::update ( const void *  data,
GLenum  dataFormat,
GLenum  dataType,
int  mipLevel,
int  width,
int  height,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with the data pointed to by data, of format dataFormat (Ex: GL_RGB), and type dataType (Ex: GL_UNSIGNED_BYTE) of size (width, height). destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Surface8u surface,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of surface. Expects surface's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Channel8u channel,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of channel. Expects channel's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Surface16u surface,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of surface. Expects surface's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Channel16u channel,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of channel. Expects channel's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Surface32f surface,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of surface. Expects surface's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const Channel32f channel,
int  mipLevel = 0,
const ivec2 &  destLowerLeftOffset = ivec2( 0, 0 ) 
)

Updates the pixels of a Texture with contents of channel. Expects channel's size to match the Texture's at mipLevel. destLowerLeftOffset specifies a texel offset to copy to within the Texture.

void cinder::gl::Texture2d::update ( const TextureData textureData)

Updates the pixels of a Texture with contents of textureData. Inefficient if the bounds of textureData don't match those of this.

void cinder::gl::Texture2d::update ( const PboRef pbo,
GLenum  format,
GLenum  type,
int  mipLevel = 0,
size_t  pboByteOffset = 0 
)

Updates the pixels of a Texture with the contents of a PBO (whose target must be GL_PIXEL_UNPACK_BUFFER) at mipmap level mipLevel. format and type correspond to parameters of glTexSubImage2D, and would often be GL_RGB and GL_UNSIGNED_BYTE respectively. Reads from the PBO starting at pboByteOffset.

void cinder::gl::Texture2d::update ( const PboRef pbo,
GLenum  format,
GLenum  type,
const Area destArea,
int  mipLevel = 0,
size_t  pboByteOffset = 0 
)

Updates a subregion (measured as origin upper-left) of the pixels of a Texture with the contents of a PBO (whose target must be GL_PIXEL_UNPACK_BUFFER) at mipmap level mipLevel. format and type correspond to parameters of glTexSubImage2D, and would often be GL_RGB and GL_UNSIGNED_BYTE respectively. Reads from the PBO starting at pboByteOffset.

void cinder::gl::Texture2d::updateFromKtx ( const DataSourceRef dataSource,
const PboRef intermediatePbo = PboRef() 
)

Updates a Texture from a KTX file. Uses intermediatePbo if supplied; requires it to be large enough to hold all MIP levels and throws if it is not.

void cinder::gl::Texture2d::updateFromDds ( const DataSourceRef dataSource,
const PboRef intermediatePbo = PboRef() 
)

Updates a Texture from a DDS file. Uses intermediatePbo if supplied; requires it to be large enough to hold all MIP levels and throws if it is not.

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

Replaces the pixels (and data store) of a Texture with contents of textureData. Use update() instead if the bounds of this match those of textureData.

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

Returns the width of the texture in pixels.

Implements cinder::gl::TextureBase.

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

Returns the height of the texture in pixels.

Implements cinder::gl::TextureBase.

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

Returns the depth of the texture in pixels.

Implements cinder::gl::TextureBase.

GLint cinder::gl::Texture2d::getActualWidth ( ) const

Returns the true width of the texture in pixels, which may be larger than it's "clean" area.

GLint cinder::gl::Texture2d::getActualHeight ( ) const

Returns the true height of the texture in pixels, which may be larger than it's "clean" area.

ivec2 cinder::gl::Texture2d::getSize ( ) const

Returns size of the texture in pixels, igonring clean bounds.

Rectf cinder::gl::Texture2d::getAreaTexCoords ( const Area area) const

Returns the UV coordinates which correspond to the pixels contained in area (as expressed with an upper-left origin, relative to clean bounds). Accounts for top-down storage and target (0-1 for GL_TEXTURE_2D and pixels for GL_TEXTURE_RECTANGLE)

bool cinder::gl::Texture2d::isTopDown ( ) const

Returns whether the scanlines of the image are stored top-down in memory relative to the base address. Default is false.

void cinder::gl::Texture2d::setTopDown ( bool  topDown = true)

Marks whether the scanlines of the image are stored top-down in memory relative to the base address. Default is false.

ImageSourceRef cinder::gl::Texture2d::createSource ( )

Returns an ImageSource pointing to this Texture.

void cinder::gl::Texture2d::printDims ( std::ostream &  os) const
overrideprotectedvirtual
void cinder::gl::Texture2d::initParams ( Format format,
GLint  defaultInternalFormat,
GLint  defaultDataType 
)
protected
void cinder::gl::Texture2d::initMaxMipmapLevel ( )
protected
template<typename T >
void cinder::gl::Texture2d::setData ( const SurfaceT< T > &  surface,
bool  createStorage,
int  mipLevel,
const ivec2 &  offset 
)
protected
template<typename T >
void cinder::gl::Texture2d::setData ( const ChannelT< T > &  channel,
bool  createStorage,
int  mipLevel,
const ivec2 &  offset 
)
protected
void cinder::gl::Texture2d::initData ( const void *  data,
GLenum  dataFormat,
const Format format 
)
protected
void cinder::gl::Texture2d::initData ( const ImageSourceRef imageSource,
const Format format 
)
protected
void cinder::gl::Texture2d::initDataImageSourceWithPboImpl ( const ImageSourceRef imageSource,
const Format format,
GLint  dataFormat,
GLint  dataType,
ImageIo::ChannelOrder  channelOrder,
bool  isGray,
const PboRef pbo 
)
protected
void cinder::gl::Texture2d::initDataImageSourceImpl ( const ImageSourceRef imageSource,
const Format format,
GLint  dataFormat,
GLint  dataType,
ImageIo::ChannelOrder  channelOrder,
bool  isGray 
)
protected
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

Friends And Related Function Documentation

friend class Texture2dCache
friend

Member Data Documentation

ivec2 cinder::gl::Texture2d::mActualSize
protected
Area cinder::gl::Texture2d::mCleanBounds
protected
bool cinder::gl::Texture2d::mTopDown
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: