Public Member Functions
-
GLintgetWidth () const override
Returns the width of the texture in pixels.
-
GLintgetHeight () const override
Returns the height of the texture in pixels.
-
GLintgetDepth () const override
Returns the depth of the texture in pixels (.
-
voidreplace (const TextureData &textureData)
Replaces the pixels (and data store) of a Texture with contents of textureData .
-
voidregenerateMipmap ()
Explicitly regenerate mipmaps assuming mipmapping is enabled.
-
voidsetDoNotDispose (bool aDoNotDispose=true)
Determines whether the Texture will call glDeleteTextures() to free the associated texture objects on destruction.
-
GLintgetInternalFormat () const
the Texture's internal format, which is the format that OpenGL stores the texture data in memory. Common values include
GL_RGB,GL_RGBAandGL_LUMINANCE -
GLuintgetId () const
the ID number for the texture, appropriate to pass to calls like
glBindTexture() -
GLenumgetTarget () const
the target associated with texture. Typical values are
GL_TEXTURE_2DandGL_TEXTURE_RECTANGLE_ARB -
voidbind (uint8_t textureUnit=0) const
Binds the Texture's texture to its target in the multitexturing unit
GL_TEXTURE0+ textureUnit . -
voidunbind (uint8_t textureUnit=0) const
Unbinds the Texture currently bound in the Texture's target.
-
floatgetAspectRatio () const
Returns the 2D aspect ratio of the texture (width / height), ignoring clean bounds.
-
getBounds () const
Returns the Area defining the Texture's bounds in pixels, ignoring clean bounds.
-
boolhasAlpha () const
Returns whether the Texture has an alpha channel based on its internal format.
-
voidsetWrap (GLenum wrapS, GLenum wrapT)
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 isGL_CLAMP_TO_EDGE. -
voidsetWrap (GLenum wrapS, GLenum wrapT, GLenum wrapR)
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 isGL_CLAMP_TO_EDGE. -
voidsetWrapS (GLenum wrapS)
Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are
GL_REPEATandGL_CLAMP_TO_EDGE, etc. Default isGL_CLAMP_TO_EDGE. -
voidsetWrapT (GLenum wrapT)
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 isGL_CLAMP_TO_EDGE. -
voidsetWrapR (GLenum wrapR)
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 isGL_CLAMP_TO_EDGE. -
voidsetMinFilter (GLenum minFilter)
Sets the filtering behavior when a texture is displayed at a lower resolution than its native resolution. Possible values are.
GL_NEARESTGL_LINEARGL_NEAREST_MIPMAP_NEARESTGL_LINEAR_MIPMAP_NEARESTGL_NEAREST_MIPMAP_LINEARGL_LINEAR_MIPMAP_LINEAR -
voidsetMagFilter (GLenum magFilter)
Sets the filtering behavior when a texture is displayed at a higher resolution than its native resolution. Possible values are
GL_NEARESTGL_LINEAR -
voidsetMaxAnisotropy (GLfloat maxAnisotropy)
Sets the anisotropic filtering amount. A value greater than 1.0 "enables" anisotropic filtering. Maximum of getMaxAnisotropyMax() ;.
-
boolhasMipmapping () const
Returns whether the Texture has Mipmapping enabled.
-
voidsetCompareMode (GLenum compareMode)
-
voidsetCompareFunc (GLenum compareFunc)
-
std::array< GLint, 4 >getSwizzleMask () const
Returns the Texture's swizzle mask (corresponding to
GL_TEXTURE_SWIZZLE_RGBA) -
const std::string &getLabel () const
Returns the debugging label associated with the Texture.
-
voidsetLabel (const std::string &label)
Sets the debugging label associated with the Texture. Calls glObjectLabel() when available.
Static Public Member Functions
-
create (int32_t width, int32_t height, const Format &format=Format())
-
create (const ImageSourceRef &imageSource, const Format &format=Format())
Automatically infers Horizontal Cross, Vertical Cross, Row, or Column based on image aspect ratio.
-
create (const ImageSourceRef images[6], const Format &format=Format())
Expects images ordered { +X, -X, +Y, -Y, +Z, -Z }.
-
create (const TextureData &data, const Format &format)
Constructs a TextureCubeMap based on an instance of TextureData .
-
createFromKtx (const DataSourceRef &dataSource, const Format &format=Format())
Constructs a TextureCubeMap from a KTX file. Enables mipmapping if KTX file contains mipmaps and Format has not specified
falsefor 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/ ) -
createFromDds (const DataSourceRef &dataSource, const Format &format=Format())
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 specifiedfalsefor mipmapping. ANGLE version requires textures to be a multiple of 4 due to DX limitation. -
GLenumgetBindingConstantForTarget (GLenum target)
Returns the appropriate parameter to glGetIntegerv() for a specific target; ie GL_TEXTURE_2D -> GL_TEXTURE_BINDING_2D. Returns 0 on failure.
-
voidgetInternalFormatInfo (GLint internalFormat, GLenum *outDataFormat, GLenum *outDataType, bool *outAlpha=nullptr, bool *outCompressed=nullptr, bool *outSrgb=nullptr)
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.
-
intrequiredMipLevels (GLint width, GLint height, GLint depth)
Returns the number of mip levels necessary to represent a texture of width , height and depth .
-
boolsurfaceRequiresIntermediate (int32_t width, uint8_t pixelBytes, ptrdiff_t rowBytes, SurfaceChannelOrder surfaceChannelOrder)
Returns whether a Surface of width , rowBytes and surfaceChannelOrder would require an intermediate Surface in order to be copied into a GL Texture.
-
voidSurfaceChannelOrderToDataFormatAndType (const SurfaceChannelOrder &sco, GLint *dataFormat, GLenum *type)
Converts a SurfaceChannelOrder into an appropriate OpenGL dataFormat and type.
-
ivec2calcMipLevelSize (int level, GLint width, GLint height)
calculate the size of mipMap for the corresponding level
-
GLfloatgetMaxAnisotropyMax ()
Returns the maximum anisotropic filtering maximum allowed by the hardware.
-
boolsupportsHardwareSwizzle ()
Returns whether this hardware supports texture swizzling (via
GL_TEXTURE_SWIZZLE_RGBA)
Protected Member Functions
-
TextureCubeMap (int32_t width, int32_t height, Format format)
-
TextureCubeMap (const SurfaceT< T > images[6], Format format)
-
TextureCubeMap (const TextureData &data, Format format)
-
voidprintDims (std::ostream &os) const override
-
voidinitParams (Format &format, GLint defaultInternalFormat, GLint defaultDataType)
-
createTextureCubeMapImpl (const ImageSourceRef &imageSource, const Format &format)