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

#include <Texture.h>

Inherits cinder::gl::TextureBase.

Classes

struct  Format
 

Public Member Functions

void update (const Surface8u &surface, int mipLevel=0)
 
void update (const void *data, GLenum dataFormat, GLenum dataType, int mipLevel, int width, int offset=0)
 
GLint getWidth () const override
 
GLint getHeight () const override
 
GLint getDepth () const override
 
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 Texture1dRef create (GLint width, const Format &format=Format())
 
static Texture1dRef create (const Surface8u &surface, const Format &format=Format())
 
static Texture1dRef create (const void *data, GLenum dataFormat, int width, 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

 Texture1d (GLint width, Format format)
 
 Texture1d (const Surface8u &surface, Format format)
 
 Texture1d (const void *data, GLenum dataFormat, int width, Format format)
 
void printDims (std::ostream &os) const override
 
void initParams (Format &format, GLint defaultInternalFormat, GLint defaultDataType)
 

Protected Attributes

GLint mWidth
 
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::Texture1d::Texture1d ( GLint  width,
Format  format 
)
protected
cinder::gl::Texture1d::Texture1d ( const Surface8u surface,
Format  format 
)
protected
cinder::gl::Texture1d::Texture1d ( const void *  data,
GLenum  dataFormat,
int  width,
Format  format 
)
protected

Member Function Documentation

Texture1dRef cinder::gl::Texture1d::create ( GLint  width,
const Format format = Format() 
)
static
Texture1dRef cinder::gl::Texture1d::create ( const Surface8u surface,
const Format format = Format() 
)
static

Constructs a Texture1d using the top row of surface.

Texture1dRef cinder::gl::Texture1d::create ( const void *  data,
GLenum  dataFormat,
int  width,
const Format format = Format() 
)
static

Constructs a Texture1d using the data pointed to by data, in format dataFormat. For a dataType other than GL_UNSIGNED_CHAR use format.setDataType()

void cinder::gl::Texture1d::update ( const Surface8u surface,
int  mipLevel = 0 
)

Updates the Texture1d using the top row of surface.

void cinder::gl::Texture1d::update ( const void *  data,
GLenum  dataFormat,
GLenum  dataType,
int  mipLevel,
int  width,
int  offset = 0 
)

Updates the pixels of a Texture1d with the data pointed to by data, of format dataFormat (Ex: GL_RGB), and type dataType (Ex: GL_UNSIGNED_BYTE) of size width.

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

Returns the width of the texture in pixels.

Implements cinder::gl::TextureBase.

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

Returns the height of the texture in pixels, which is always 1.

Implements cinder::gl::TextureBase.

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

Returns the depth of the texture, which is always 1.

Implements cinder::gl::TextureBase.

void cinder::gl::Texture1d::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::Texture1d::mWidth
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: