Public Member Functions
-
~TextureBase ()
-
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.
-
GLintgetWidth () const =0
Returns the width of the texture in pixels, ignoring clean bounds.
-
GLintgetHeight () const =0
Returns the height of the texture in pixels, ignoring clean bounds.
-
GLintgetDepth () const =0
Returns the depth of the texture in pixels, ignoring clean bounds.
-
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
-
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)