Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QOpenGLTexture Class Reference

\inmodule QtGui More...

#include <qopengltexture.h>

+ Collaboration diagram for QOpenGLTexture:

Public Types

enum  Target {
  Target1D = 0x0DE0 , Target1DArray = 0x8C18 , Target2D = 0x0DE1 , Target2DArray = 0x8C1A ,
  Target3D = 0x806F , TargetCubeMap = 0x8513 , TargetCubeMapArray = 0x9009 , Target2DMultisample = 0x9100 ,
  Target2DMultisampleArray = 0x9102 , TargetRectangle = 0x84F5 , TargetBuffer = 0x8C2A
}
 This enum defines the texture target of a QOpenGLTexture object. More...
 
enum  BindingTarget {
  BindingTarget1D = 0x8068 , BindingTarget1DArray = 0x8C1C , BindingTarget2D = 0x8069 , BindingTarget2DArray = 0x8C1D ,
  BindingTarget3D = 0x806A , BindingTargetCubeMap = 0x8514 , BindingTargetCubeMapArray = 0x900A , BindingTarget2DMultisample = 0x9104 ,
  BindingTarget2DMultisampleArray = 0x9105 , BindingTargetRectangle = 0x84F6 , BindingTargetBuffer = 0x8C2C
}
 This enum defines the possible binding targets of texture units. More...
 
enum  MipMapGeneration { GenerateMipMaps , DontGenerateMipMaps }
 This enum defines the options to control mipmap generation. More...
 
enum  TextureUnitReset { ResetTextureUnit , DontResetTextureUnit }
 This enum defines options ot control texture unit activation. More...
 
enum  TextureFormat {
  NoFormat = 0 , R8_UNorm = 0x8229 , RG8_UNorm = 0x822B , RGB8_UNorm = 0x8051 ,
  RGBA8_UNorm = 0x8058 , R16_UNorm = 0x822A , RG16_UNorm = 0x822C , RGB16_UNorm = 0x8054 ,
  RGBA16_UNorm = 0x805B , R8_SNorm = 0x8F94 , RG8_SNorm = 0x8F95 , RGB8_SNorm = 0x8F96 ,
  RGBA8_SNorm = 0x8F97 , R16_SNorm = 0x8F98 , RG16_SNorm = 0x8F99 , RGB16_SNorm = 0x8F9A ,
  RGBA16_SNorm = 0x8F9B , R8U = 0x8232 , RG8U = 0x8238 , RGB8U = 0x8D7D ,
  RGBA8U = 0x8D7C , R16U = 0x8234 , RG16U = 0x823A , RGB16U = 0x8D77 ,
  RGBA16U = 0x8D76 , R32U = 0x8236 , RG32U = 0x823C , RGB32U = 0x8D71 ,
  RGBA32U = 0x8D70 , R8I = 0x8231 , RG8I = 0x8237 , RGB8I = 0x8D8F ,
  RGBA8I = 0x8D8E , R16I = 0x8233 , RG16I = 0x8239 , RGB16I = 0x8D89 ,
  RGBA16I = 0x8D88 , R32I = 0x8235 , RG32I = 0x823B , RGB32I = 0x8D83 ,
  RGBA32I = 0x8D82 , R16F = 0x822D , RG16F = 0x822F , RGB16F = 0x881B ,
  RGBA16F = 0x881A , R32F = 0x822E , RG32F = 0x8230 , RGB32F = 0x8815 ,
  RGBA32F = 0x8814 , RGB9E5 = 0x8C3D , RG11B10F = 0x8C3A , RG3B2 = 0x2A10 ,
  R5G6B5 = 0x8D62 , RGB5A1 = 0x8057 , RGBA4 = 0x8056 , RGB10A2 = 0x906F ,
  D16 = 0x81A5 , D24 = 0x81A6 , D24S8 = 0x88F0 , D32 = 0x81A7 ,
  D32F = 0x8CAC , D32FS8X24 = 0x8CAD , S8 = 0x8D48 , RGB_DXT1 = 0x83F0 ,
  RGBA_DXT1 = 0x83F1 , RGBA_DXT3 = 0x83F2 , RGBA_DXT5 = 0x83F3 , R_ATI1N_UNorm = 0x8DBB ,
  R_ATI1N_SNorm = 0x8DBC , RG_ATI2N_UNorm = 0x8DBD , RG_ATI2N_SNorm = 0x8DBE , RGB_BP_UNSIGNED_FLOAT = 0x8E8F ,
  RGB_BP_SIGNED_FLOAT = 0x8E8E , RGB_BP_UNorm = 0x8E8C , R11_EAC_UNorm = 0x9270 , R11_EAC_SNorm = 0x9271 ,
  RG11_EAC_UNorm = 0x9272 , RG11_EAC_SNorm = 0x9273 , RGB8_ETC2 = 0x9274 , SRGB8_ETC2 = 0x9275 ,
  RGB8_PunchThrough_Alpha1_ETC2 = 0x9276 , SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277 , RGBA8_ETC2_EAC = 0x9278 , SRGB8_Alpha8_ETC2_EAC = 0x9279 ,
  RGB8_ETC1 = 0x8D64 , RGBA_ASTC_4x4 = 0x93B0 , RGBA_ASTC_5x4 = 0x93B1 , RGBA_ASTC_5x5 = 0x93B2 ,
  RGBA_ASTC_6x5 = 0x93B3 , RGBA_ASTC_6x6 = 0x93B4 , RGBA_ASTC_8x5 = 0x93B5 , RGBA_ASTC_8x6 = 0x93B6 ,
  RGBA_ASTC_8x8 = 0x93B7 , RGBA_ASTC_10x5 = 0x93B8 , RGBA_ASTC_10x6 = 0x93B9 , RGBA_ASTC_10x8 = 0x93BA ,
  RGBA_ASTC_10x10 = 0x93BB , RGBA_ASTC_12x10 = 0x93BC , RGBA_ASTC_12x12 = 0x93BD , SRGB8_Alpha8_ASTC_4x4 = 0x93D0 ,
  SRGB8_Alpha8_ASTC_5x4 = 0x93D1 , SRGB8_Alpha8_ASTC_5x5 = 0x93D2 , SRGB8_Alpha8_ASTC_6x5 = 0x93D3 , SRGB8_Alpha8_ASTC_6x6 = 0x93D4 ,
  SRGB8_Alpha8_ASTC_8x5 = 0x93D5 , SRGB8_Alpha8_ASTC_8x6 = 0x93D6 , SRGB8_Alpha8_ASTC_8x8 = 0x93D7 , SRGB8_Alpha8_ASTC_10x5 = 0x93D8 ,
  SRGB8_Alpha8_ASTC_10x6 = 0x93D9 , SRGB8_Alpha8_ASTC_10x8 = 0x93DA , SRGB8_Alpha8_ASTC_10x10 = 0x93DB , SRGB8_Alpha8_ASTC_12x10 = 0x93DC ,
  SRGB8_Alpha8_ASTC_12x12 = 0x93DD , SRGB8 = 0x8C41 , SRGB8_Alpha8 = 0x8C43 , SRGB_DXT1 = 0x8C4C ,
  SRGB_Alpha_DXT1 = 0x8C4D , SRGB_Alpha_DXT3 = 0x8C4E , SRGB_Alpha_DXT5 = 0x8C4F , SRGB_BP_UNorm = 0x8E8D ,
  DepthFormat = 0x1902 , AlphaFormat = 0x1906 , RGBFormat = 0x1907 , RGBAFormat = 0x1908 ,
  LuminanceFormat = 0x1909 , LuminanceAlphaFormat = 0x190A
}
 This enum defines the possible texture formats. More...
 
enum  TextureFormatClass {
  NoFormatClass , FormatClass_128Bit , FormatClass_96Bit , FormatClass_64Bit ,
  FormatClass_48Bit , FormatClass_32Bit , FormatClass_24Bit , FormatClass_16Bit ,
  FormatClass_8Bit , FormatClass_RGTC1_R , FormatClass_RGTC2_RG , FormatClass_BPTC_Unorm ,
  FormatClass_BPTC_Float , FormatClass_S3TC_DXT1_RGB , FormatClass_S3TC_DXT1_RGBA , FormatClass_S3TC_DXT3_RGBA ,
  FormatClass_S3TC_DXT5_RGBA , FormatClass_Unique
}
 
enum  CubeMapFace {
  CubeMapPositiveX = 0x8515 , CubeMapNegativeX = 0x8516 , CubeMapPositiveY = 0x8517 , CubeMapNegativeY = 0x8518 ,
  CubeMapPositiveZ = 0x8519 , CubeMapNegativeZ = 0x851A
}
 This enum defines the possible CubeMap faces. More...
 
enum  PixelFormat {
  NoSourceFormat = 0 , Red = 0x1903 , RG = 0x8227 , RGB = 0x1907 ,
  BGR = 0x80E0 , RGBA = 0x1908 , BGRA = 0x80E1 , Red_Integer = 0x8D94 ,
  RG_Integer = 0x8228 , RGB_Integer = 0x8D98 , BGR_Integer = 0x8D9A , RGBA_Integer = 0x8D99 ,
  BGRA_Integer = 0x8D9B , Stencil = 0x1901 , Depth = 0x1902 , DepthStencil = 0x84F9 ,
  Alpha = 0x1906 , Luminance = 0x1909 , LuminanceAlpha = 0x190A
}
 This enum defines the possible client-side pixel formats for a pixel transfer operation. More...
 
enum  PixelType {
  NoPixelType = 0 , Int8 = 0x1400 , UInt8 = 0x1401 , Int16 = 0x1402 ,
  UInt16 = 0x1403 , Int32 = 0x1404 , UInt32 = 0x1405 , Float16 = 0x140B ,
  Float16OES = 0x8D61 , Float32 = 0x1406 , UInt32_RGB9_E5 = 0x8C3E , UInt32_RG11B10F = 0x8C3B ,
  UInt8_RG3B2 = 0x8032 , UInt8_RG3B2_Rev = 0x8362 , UInt16_RGB5A1 = 0x8034 , UInt16_RGB5A1_Rev = 0x8366 ,
  UInt16_R5G6B5 = 0x8363 , UInt16_R5G6B5_Rev = 0x8364 , UInt16_RGBA4 = 0x8033 , UInt16_RGBA4_Rev = 0x8365 ,
  UInt32_RGBA8 = 0x8035 , UInt32_RGBA8_Rev = 0x8367 , UInt32_RGB10A2 = 0x8036 , UInt32_RGB10A2_Rev = 0x8368 ,
  UInt32_D24S8 = 0x84FA , Float32_D32_UInt32_S8_X24 = 0x8DAD
}
 This enum defines the possible pixel data types for a pixel transfer operation. More...
 
enum  SwizzleComponent { SwizzleRed = 0x8E42 , SwizzleGreen = 0x8E43 , SwizzleBlue = 0x8E44 , SwizzleAlpha = 0x8E45 }
 This enum defines the texture color components that can be assigned a swizzle mask. More...
 
enum  SwizzleValue {
  RedValue = 0x1903 , GreenValue = 0x1904 , BlueValue = 0x1905 , AlphaValue = 0x1906 ,
  ZeroValue = 0 , OneValue = 1
}
 This enum defines the possible mask values for texture swizzling. More...
 
enum  WrapMode { Repeat = 0x2901 , MirroredRepeat = 0x8370 , ClampToEdge = 0x812F , ClampToBorder = 0x812D }
 This enum defines the possible texture coordinate wrapping modes. More...
 
enum  CoordinateDirection { DirectionS = 0x2802 , DirectionT = 0x2803 , DirectionR = 0x8072 }
 This enum defines the possible texture coordinate directions. More...
 
enum  Feature {
  ImmutableStorage = 0x00000001 , ImmutableMultisampleStorage = 0x00000002 , TextureRectangle = 0x00000004 , TextureArrays = 0x00000008 ,
  Texture3D = 0x00000010 , TextureMultisample = 0x00000020 , TextureBuffer = 0x00000040 , TextureCubeMapArrays = 0x00000080 ,
  Swizzle = 0x00000100 , StencilTexturing = 0x00000200 , AnisotropicFiltering = 0x00000400 , NPOTTextures = 0x00000800 ,
  NPOTTextureRepeat = 0x00001000 , Texture1D = 0x00002000 , TextureComparisonOperators = 0x00004000 , TextureMipMapLevel = 0x00008000 ,
  MaxFeatureFlag = 0x00010000
}
 This enum defines the OpenGL texture-related features that can be tested for. More...
 
enum  DepthStencilMode { DepthMode = 0x1902 , StencilMode = 0x1901 }
 
enum  ComparisonFunction {
  CompareLessEqual = 0x0203 , CompareGreaterEqual = 0x0206 , CompareLess = 0x0201 , CompareGreater = 0x0204 ,
  CompareEqual = 0x0202 , CompareNotEqual = 0x0205 , CompareAlways = 0x0207 , CompareNever = 0x0200
}
 
enum  ComparisonMode { CompareRefToTexture = 0x884E , CompareNone = 0x0000 }
 
enum  Filter {
  Nearest = 0x2600 , Linear = 0x2601 , NearestMipMapNearest = 0x2700 , NearestMipMapLinear = 0x2702 ,
  LinearMipMapNearest = 0x2701 , LinearMipMapLinear = 0x2703
}
 This enum defines the filtering parameters for a QOpenGLTexture object. More...
 

Public Member Functions

 QOpenGLTexture (Target target)
 Creates a QOpenGLTexture object that can later be bound to target.
 
 QOpenGLTexture (const QImage &image, MipMapGeneration genMipMaps=GenerateMipMaps)
 Creates a QOpenGLTexture object that can later be bound to the 2D texture target and contains the pixel data contained in image.
 
 ~QOpenGLTexture ()
 
Target target () const
 Returns the binding target of this texture.
 
bool create ()
 Creates the underlying OpenGL texture object.
 
void destroy ()
 Destroys the underlying OpenGL texture object.
 
bool isCreated () const
 Returns true if the underlying OpenGL texture object has been created.
 
GLuint textureId () const
 Returns the name of the underlying OpenGL texture object or 0 if it has not yet been created.
 
void bind ()
 Binds this texture to the currently active texture unit ready for rendering.
 
void bind (uint unit, TextureUnitReset reset=DontResetTextureUnit)
 Binds this texture to texture unit unit ready for rendering.
 
void release ()
 Unbinds this texture from the currently active texture unit.
 
void release (uint unit, TextureUnitReset reset=DontResetTextureUnit)
 Unbinds this texture from texture unit unit.
 
bool isBound () const
 Returns true if this texture is bound to the corresponding target of the currently active texture unit.
 
bool isBound (uint unit)
 Returns true if this texture is bound to the corresponding target of texture unit unit.
 
void setFormat (TextureFormat format)
 Sets the format of this texture object to format.
 
TextureFormat format () const
 Returns the format of this texture object.
 
void setSize (int width, int height=1, int depth=1)
 Sets the dimensions of this texture object to width, height, and depth.
 
int width () const
 Returns the width of a 1D, 2D or 3D texture.
 
int height () const
 Returns the height of a 2D or 3D texture.
 
int depth () const
 Returns the depth of a 3D texture.
 
void setMipLevels (int levels)
 For texture targets that support mipmaps, this function sets the requested number of mipmap levels to allocate storage for.
 
int mipLevels () const
 Returns the number of mipmap levels for this texture.
 
int maximumMipLevels () const
 Returns the maximum number of mipmap levels that this texture can have given the current dimensions.
 
void setLayers (int layers)
 Sets the number of array layers to allocate storage for.
 
int layers () const
 Returns the number of array layers for this texture.
 
int faces () const
 Returns the number of faces for this texture.
 
void setSamples (int samples)
 Sets the number of samples to allocate storage for when rendering to a multisample capable texture target.
 
int samples () const
 Returns the number of multisample sample points for this texture.
 
void setFixedSamplePositions (bool fixed)
 Sets whether the sample positions and number of samples used with a multisample capable texture target to fixed.
 
bool isFixedSamplePositions () const
 Returns whether this texture uses a fixed pattern of multisample samples.
 
void allocateStorage ()
 Allocates server-side storage for this texture object taking into account, the format, dimensions, mipmap levels, array layers and cubemap faces.
 
void allocateStorage (PixelFormat pixelFormat, PixelType pixelType)
 
bool isStorageAllocated () const
 Returns true if server-side storage for this texture as been allocated.
 
QOpenGLTexturecreateTextureView (Target target, TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const
 Attempts to create a texture view onto this texture.
 
bool isTextureView () const
 Returns true if this texture object is actually a view onto another texture object.
 
void setData (int mipLevel, int layer, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 Uploads pixel data for this texture object mipLevel, array layer, and cubeFace.
 
void setData (int mipLevel, int layer, int layerCount, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int mipLevel, int layer, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int mipLevel, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int xOffset, int yOffset, int zOffset, int width, int height, int depth, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setData (int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, CubeMapFace cubeFace, int layerCount, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setCompressedData (int mipLevel, int layer, CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 Uploads compressed pixel data to mipLevel, array layer, and cubeFace.
 
void setCompressedData (int mipLevel, int layer, int layerCount, CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 
void setCompressedData (int mipLevel, int layer, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setCompressedData (int mipLevel, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setCompressedData (int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setData (const QImage &image, MipMapGeneration genMipMaps=GenerateMipMaps)
 This overload of setData() will allocate storage for you.
 
void setMipBaseLevel (int baseLevel)
 Sets the base mipmap level used for all texture lookups with this texture to baseLevel.
 
int mipBaseLevel () const
 Returns the mipmap base level used for all texture lookups with this texture.
 
void setMipMaxLevel (int maxLevel)
 Sets the maximum mipmap level used for all texture lookups with this texture to maxLevel.
 
int mipMaxLevel () const
 Returns the mipmap maximum level used for all texture lookups with this texture.
 
void setMipLevelRange (int baseLevel, int maxLevel)
 Sets the range of mipmap levels that can be used for texture lookups with this texture to range from baseLevel to maxLevel.
 
QPair< int, int > mipLevelRange () const
 Returns the range of mipmap levels that can be used for texture lookups with this texture.
 
void setAutoMipMapGenerationEnabled (bool enabled)
 If enabled is true, enables automatic mipmap generation for this texture object to occur whenever the level 0 mipmap data is set via setData().
 
bool isAutoMipMapGenerationEnabled () const
 Returns whether auto mipmap generation is enabled for this texture object.
 
void generateMipMaps ()
 Generates mipmaps for this texture object from mipmap level 0.
 
void generateMipMaps (int baseLevel, bool resetBaseLevel=true)
 Generates mipmaps for this texture object from mipmap level baseLevel.
 
void setSwizzleMask (SwizzleComponent component, SwizzleValue value)
 GLSL shaders are able to reorder the components of the vec4 returned by texture functions.
 
void setSwizzleMask (SwizzleValue r, SwizzleValue g, SwizzleValue b, SwizzleValue a)
 Parameters {r}, {g}, {b}, and {a} are values used for setting the colors red, green, blue, and the alpha value.
 
SwizzleValue swizzleMask (SwizzleComponent component) const
 Returns the swizzle mask for texture component.
 
void setDepthStencilMode (DepthStencilMode mode)
 If using a texture that has a combined depth/stencil format this function sets which component of the texture is accessed to mode.
 
DepthStencilMode depthStencilMode () const
 Returns the depth stencil mode for textures using a combined depth/stencil format.
 
void setComparisonFunction (ComparisonFunction function)
 
ComparisonFunction comparisonFunction () const
 
void setComparisonMode (ComparisonMode mode)
 
ComparisonMode comparisonMode () const
 
void setMinificationFilter (Filter filter)
 Sets the filter used for minification to filter.
 
Filter minificationFilter () const
 Returns the minification filter.
 
void setMagnificationFilter (Filter filter)
 Sets the magnification filter to filter.
 
Filter magnificationFilter () const
 Returns the magnification filter.
 
void setMinMagFilters (Filter minificationFilter, Filter magnificationFilter)
 Sets the minification filter to minificationFilter and the magnification filter to magnificationFilter.
 
QPair< Filter, FilterminMagFilters () const
 Returns the current minification and magnification filters.
 
void setMaximumAnisotropy (float anisotropy)
 If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension this function sets the maximum anisotropy level to anisotropy.
 
float maximumAnisotropy () const
 Returns the maximum level of anisotropy to be accounted for when performing texture lookups.
 
void setWrapMode (WrapMode mode)
 Sets the wrap (or repeat mode) for all texture dimensions to mode.
 
void setWrapMode (CoordinateDirection direction, WrapMode mode)
 Holds the texture dimension direction.
 
WrapMode wrapMode (CoordinateDirection direction) const
 Returns the wrap mode for the texture dimension direction.
 
void setBorderColor (const QColor &color)
 Sets the border color of the texture to color.
 
void setBorderColor (float r, float g, float b, float a)
 Sets the color red to {r}, green to {g}, blue to {b}, and {a} to the alpha value.
 
void setBorderColor (int r, int g, int b, int a)
 Sets the color red to {r}, green to {g}, blue to {b}, and the alpha value to {a}.
 
void setBorderColor (uint r, uint g, uint b, uint a)
 Sets the color red to {r}, green to {g}, blue to {b}, and the alpha value to {a}.
 
QColor borderColor () const
 Returns the borderColor of this texture.
 
void borderColor (float *border) const
 Writes the texture border color into the first four elements of the array pointed to by border.
 
void borderColor (int *border) const
 Writes the texture border color into the first four elements of the array pointed to by border.
 
void borderColor (unsigned int *border) const
 Writes the texture border color into the first four elements of the array pointed to by border.
 
void setMinimumLevelOfDetail (float value)
 Sets the minimum level of detail to value.
 
float minimumLevelOfDetail () const
 Returns the minimum level of detail parameter.
 
void setMaximumLevelOfDetail (float value)
 Sets the maximum level of detail to value.
 
float maximumLevelOfDetail () const
 Returns the maximum level of detail parameter.
 
void setLevelOfDetailRange (float min, float max)
 Sets the minimum level of detail parameters to min and the maximum level to max.
 
QPair< float, float > levelOfDetailRange () const
 Returns the minimum and maximum level of detail parameters.
 
void setLevelofDetailBias (float bias)
 Sets the level of detail bias to bias.
 
float levelofDetailBias () const
 Returns the level of detail bias parameter.
 

Static Public Member Functions

static GLuint boundTextureId (BindingTarget target)
 Returns the textureId of the texture that is bound to the target of the currently active texture unit.
 
static GLuint boundTextureId (uint unit, BindingTarget target)
 Returns the textureId of the texture that is bound to the target of the texture unit unit.
 
static bool hasFeature (Feature feature)
 Returns true if your OpenGL implementation and version supports the texture feature feature.
 

Friends

Q_OPENGL_EXPORT QDebug operator<< (QDebug dbg, const QOpenGLTexture *t)
 

Detailed Description

\inmodule QtGui

Since
5.2 \wrapper

The QOpenGLTexture class encapsulates an OpenGL texture object.

QOpenGLTexture makes it easy to work with OpenGL textures and the myriad features and targets that they offer depending upon the capabilities of your OpenGL implementation.

The typical usage pattern for QOpenGLTexture is \list

  • Instantiate the object specifying the texture target type
  • Set properties that affect the storage requirements e.g. storage format, dimensions
  • Allocate the server-side storage
  • Optionally upload pixel data
  • Optionally set any additional properties e.g. filtering and border options
  • Render with texture or render to texture \endlist

In the common case of simply using a QImage as the source of texture pixel data most of the above steps are performed automatically.

// Prepare texture
texture->setMagnificationFilter(QOpenGLTexture::Linear);
...
// Render with texture
texture->bind();
glDrawArrays(...);
\inmodule QtGui
Definition qimage.h:37
\inmodule QtGui
QOpenGLTexture(Target target)
Creates a QOpenGLTexture object that can later be bound to target.
GLenum GLuint texture

Note that the QImage is mirrored vertically to account for the fact that OpenGL and QImage use opposite directions for the y axis. Another option would be to transform your texture coordinates.

Definition at line 21 of file qopengltexture.h.

Member Enumeration Documentation

◆ BindingTarget

This enum defines the possible binding targets of texture units.

\value BindingTarget1D Equivalent to GL_TEXTURE_BINDING_1D \value BindingTarget1DArray Equivalent to GL_TEXTURE_BINDING_1D_ARRAY \value BindingTarget2D Equivalent to GL_TEXTURE_BINDING_2D \value BindingTarget2DArray Equivalent to GL_TEXTURE_BINDING_2D_ARRAY \value BindingTarget3D Equivalent to GL_TEXTURE_BINDING_3D \value BindingTargetCubeMap Equivalent to GL_TEXTURE_BINDING_CUBE_MAP \value BindingTargetCubeMapArray Equivalent to GL_TEXTURE_BINDING_CUBE_MAP_ARRAY \value BindingTarget2DMultisample Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE \value BindingTarget2DMultisampleArray Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY \value BindingTargetRectangle Equivalent to GL_TEXTURE_BINDING_RECTANGLE \value BindingTargetBuffer Equivalent to GL_TEXTURE_BINDING_BUFFER

Enumerator
BindingTarget1D 
BindingTarget1DArray 
BindingTarget2D 
BindingTarget2DArray 
BindingTarget3D 
BindingTargetCubeMap 
BindingTargetCubeMapArray 
BindingTarget2DMultisample 
BindingTarget2DMultisampleArray 
BindingTargetRectangle 
BindingTargetBuffer 

Definition at line 40 of file qopengltexture.h.

◆ ComparisonFunction

Since
5.5 This enum specifies which comparison operator is used when texture comparison is enabled on this texture.

\value CompareLessEqual Equivalent to GL_LEQUAL. \value CompareGreaterEqual Equivalent to GL_GEQUAL. \value CompareLess Equivalent to GL_LESS. \value CompareGreater Equivalent to GL_GREATER. \value CompareEqual Equivalent to GL_EQUAL. \value CompareNotEqual Equivalent to GL_NOTEQUAL. \value CompareAlways Equivalent to GL_ALWAYS. \value CompareNever Equivalent to GL_NEVER.

\omitvalue CommpareNotEqual

Enumerator
CompareLessEqual 
CompareGreaterEqual 
CompareLess 
CompareGreater 
CompareEqual 
CompareNotEqual 
CompareAlways 
CompareNever 

Definition at line 511 of file qopengltexture.h.

◆ ComparisonMode

Since
5.5 This enum specifies which comparison mode is used when sampling this texture.

\value CompareRefToTexture Equivalent to GL_COMPARE_REF_TO_TEXTURE. \value CompareNone Equivalent to GL_NONE.

Enumerator
CompareRefToTexture 
CompareNone 

Definition at line 531 of file qopengltexture.h.

◆ CoordinateDirection

This enum defines the possible texture coordinate directions.

\value DirectionS The horizontal direction. Equivalent to GL_TEXTURE_WRAP_S \value DirectionT The vertical direction. Equivalent to GL_TEXTURE_WRAP_T \value DirectionR The depth direction. Equivalent to GL_TEXTURE_WRAP_R

Enumerator
DirectionS 
DirectionT 
DirectionR 

Definition at line 339 of file qopengltexture.h.

◆ CubeMapFace

This enum defines the possible CubeMap faces.

\value CubeMapPositiveX Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_X \value CubeMapNegativeX Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_X \value CubeMapPositiveY Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Y \value CubeMapNegativeY Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Y \value CubeMapPositiveZ Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Z \value CubeMapNegativeZ Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

Enumerator
CubeMapPositiveX 
CubeMapNegativeX 
CubeMapPositiveY 
CubeMapNegativeY 
CubeMapPositiveZ 
CubeMapNegativeZ 

Definition at line 250 of file qopengltexture.h.

◆ DepthStencilMode

Since
5.4 This enum specifies which component of a depth/stencil texture is accessed when the texture is sampled.

\value DepthMode Equivalent to GL_DEPTH_COMPONENT. \value StencilMode Equivalent to GL_STENCIL_INDEX.

Enumerator
DepthMode 
StencilMode 

Definition at line 502 of file qopengltexture.h.

◆ Feature

This enum defines the OpenGL texture-related features that can be tested for.

\value ImmutableStorage Support for immutable texture storage \value ImmutableMultisampleStorage Support for immutable texture storage with multisample targets \value TextureRectangle Support for the GL_TEXTURE_RECTANGLE target \value TextureArrays Support for texture targets with array layers \value Texture3D Support for the 3 dimensional texture target \value TextureMultisample Support for texture targets that have multisample capabilities \value TextureBuffer Support for textures that use OpenGL buffer objects as their data source \value TextureCubeMapArrays Support for cubemap array texture target \value Swizzle Support for texture component swizzle masks \value StencilTexturing Support for stencil texturing (i.e. looking up depth or stencil components of a combined depth/stencil format texture in GLSL shaders). \value AnisotropicFiltering Support for anisotropic texture filtering \value NPOTTextures Basic support for non-power-of-two textures \value NPOTTextureRepeat Full support for non-power-of-two textures including texture repeat modes \value Texture1D Support for the 1 dimensional texture target \value TextureComparisonOperators Support for texture comparison operators \value TextureMipMapLevel Support for setting the base and maximum mipmap levels

Enumerator
ImmutableStorage 
ImmutableMultisampleStorage 
TextureRectangle 
TextureArrays 
Texture3D 
TextureMultisample 
TextureBuffer 
TextureCubeMapArrays 
Swizzle 
StencilTexturing 
AnisotropicFiltering 
NPOTTextures 
NPOTTextureRepeat 
Texture1D 
TextureComparisonOperators 
TextureMipMapLevel 
MaxFeatureFlag 

Definition at line 347 of file qopengltexture.h.

◆ Filter

This enum defines the filtering parameters for a QOpenGLTexture object.

\value Nearest Equivalent to GL_NEAREST \value Linear Equivalent to GL_LINEAR \value NearestMipMapNearest Equivalent to GL_NEAREST_MIPMAP_NEAREST \value NearestMipMapLinear Equivalent to GL_NEAREST_MIPMAP_LINEAR \value LinearMipMapNearest Equivalent to GL_LINEAR_MIPMAP_NEAREST \value LinearMipMapLinear Equivalent to GL_LINEAR_MIPMAP_LINEAR

Enumerator
Nearest 
Linear 
NearestMipMapNearest 
NearestMipMapLinear 
LinearMipMapNearest 
LinearMipMapLinear 

Definition at line 540 of file qopengltexture.h.

◆ MipMapGeneration

This enum defines the options to control mipmap generation.

\value GenerateMipMaps Mipmaps should be generated \value DontGenerateMipMaps Mipmaps should not be generated

Enumerator
GenerateMipMaps 
DontGenerateMipMaps 

Definition at line 55 of file qopengltexture.h.

◆ PixelFormat

This enum defines the possible client-side pixel formats for a pixel transfer operation.

\value NoSourceFormat Equivalent to GL_NONE \value Red Equivalent to GL_RED \value RG Equivalent to GL_RG \value RGB Equivalent to GL_RGB \value BGR Equivalent to GL_BGR \value RGBA Equivalent to GL_RGBA \value BGRA Equivalent to GL_BGRA \value Red_Integer Equivalent to GL_RED_INTEGER \value RG_Integer Equivalent to GL_RG_INTEGER \value RGB_Integer Equivalent to GL_RGB_INTEGER \value BGR_Integer Equivalent to GL_BGR_INTEGER \value RGBA_Integer Equivalent to GL_RGBA_INTEGER \value BGRA_Integer Equivalent to GL_BGRA_INTEGER \value Stencil Equivalent to GL_STENCIL_INDEX. Introduced in Qt 5.4 \value Depth Equivalent to GL_DEPTH_COMPONENT \value DepthStencil Equivalent to GL_DEPTH_STENCIL \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only) \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only) \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)

Enumerator
NoSourceFormat 
Red 
RG 
RGB 
BGR 
RGBA 
BGRA 
Red_Integer 
RG_Integer 
RGB_Integer 
BGR_Integer 
RGBA_Integer 
BGRA_Integer 
Stencil 
Depth 
DepthStencil 
Alpha 
Luminance 
LuminanceAlpha 

Definition at line 260 of file qopengltexture.h.

◆ PixelType

This enum defines the possible pixel data types for a pixel transfer operation.

\value NoPixelType Equivalent to GL_NONE \value Int8 Equivalent to GL_BYTE \value UInt8 Equivalent to GL_UNSIGNED_BYTE \value Int16 Equivalent to GL_SHORT \value UInt16 Equivalent to GL_UNSIGNED_SHORT \value Int32 Equivalent to GL_INT \value UInt32 Equivalent to GL_UNSIGNED_INT \value Float16 Equivalent to GL_HALF_FLOAT \value Float16OES Equivalent to GL_HALF_FLOAT_OES \value Float32 Equivalent to GL_FLOAT \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV \value UInt8_RG3B2 Equivalent to GL_UNSIGNED_BYTE_3_3_2 \value UInt8_RG3B2_Rev Equivalent to GL_UNSIGNED_BYTE_2_3_3_REV \value UInt16_RGB5A1 Equivalent to GL_UNSIGNED_SHORT_5_5_5_1 \value UInt16_RGB5A1_Rev Equivalent to GL_UNSIGNED_SHORT_1_5_5_5_REV \value UInt16_R5G6B5 Equivalent to GL_UNSIGNED_SHORT_5_6_5 \value UInt16_R5G6B5_Rev Equivalent to GL_UNSIGNED_SHORT_5_6_5_REV \value UInt16_RGBA4 Equivalent to GL_UNSIGNED_SHORT_4_4_4_4 \value UInt16_RGBA4_Rev Equivalent to GL_UNSIGNED_SHORT_4_4_4_4_REV \value UInt32_RGBA8 Equivalent to GL_UNSIGNED_INT_8_8_8_8 \value UInt32_RGBA8_Rev Equivalent to GL_UNSIGNED_INT_8_8_8_8_REV \value UInt32_RGB10A2 Equivalent to GL_UNSIGNED_INT_10_10_10_2 \value UInt32_RGB10A2_Rev Equivalent to GL_UNSIGNED_INT_2_10_10_10_REV \value UInt32_D24S8 Equivalent to GL_UNSIGNED_INT_24_8. Introduced in Qt 5.4 \value Float32_D32_UInt32_S8_X24 Equivalent to GL_FLOAT_32_UNSIGNED_INT_24_8_REV. Introduced in Qt 5.4

Enumerator
NoPixelType 
Int8 
UInt8 
Int16 
UInt16 
Int32 
UInt32 
Float16 
Float16OES 
Float32 
UInt32_RGB9_E5 
UInt32_RG11B10F 
UInt8_RG3B2 
UInt8_RG3B2_Rev 
UInt16_RGB5A1 
UInt16_RGB5A1_Rev 
UInt16_R5G6B5 
UInt16_R5G6B5_Rev 
UInt16_RGBA4 
UInt16_RGBA4_Rev 
UInt32_RGBA8 
UInt32_RGBA8_Rev 
UInt32_RGB10A2 
UInt32_RGB10A2_Rev 
UInt32_D24S8 
Float32_D32_UInt32_S8_X24 

Definition at line 283 of file qopengltexture.h.

◆ SwizzleComponent

This enum defines the texture color components that can be assigned a swizzle mask.

\value SwizzleRed The red component. Equivalent to GL_TEXTURE_SWIZZLE_R \value SwizzleGreen The green component. Equivalent to GL_TEXTURE_SWIZZLE_G \value SwizzleBlue The blue component. Equivalent to GL_TEXTURE_SWIZZLE_B \value SwizzleAlpha The alpha component. Equivalent to GL_TEXTURE_SWIZZLE_A

Enumerator
SwizzleRed 
SwizzleGreen 
SwizzleBlue 
SwizzleAlpha 

Definition at line 313 of file qopengltexture.h.

◆ SwizzleValue

This enum defines the possible mask values for texture swizzling.

\value RedValue Maps the component to the red channel. Equivalent to GL_RED \value GreenValue Maps the component to the green channel. Equivalent to GL_GREEN \value BlueValue Maps the component to the blue channel. Equivalent to GL_BLUE \value AlphaValue Maps the component to the alpha channel. Equivalent to GL_ALPHA \value ZeroValue Maps the component to a fixed value of 0. Equivalent to GL_ZERO \value OneValue Maps the component to a fixed value of 1. Equivalent to GL_ONE

Enumerator
RedValue 
GreenValue 
BlueValue 
AlphaValue 
ZeroValue 
OneValue 

Definition at line 321 of file qopengltexture.h.

◆ Target

This enum defines the texture target of a QOpenGLTexture object.

For more information on creating array textures, see \l{Array Texture}.

\value Target1D A 1-dimensional texture. Equivalent to GL_TEXTURE_1D. \value Target1DArray An array of 1-dimensional textures. Equivalent to GL_TEXTURE_1D_ARRAY \value Target2D A 2-dimensional texture. Equivalent to GL_TEXTURE_2D \value Target2DArray An array of 2-dimensional textures. Equivalent to GL_TEXTURE_2D_ARRAY \value Target3D A 3-dimensional texture. Equivalent to GL_TEXTURE_3D \value TargetCubeMap A cubemap texture. Equivalent to GL_TEXTURE_CUBE_MAP \value TargetCubeMapArray An array of cubemap textures. Equivalent to GL_TEXTURE_CUBE_MAP_ARRAY \value Target2DMultisample A 2-dimensional texture with multisample support. Equivalent to GL_TEXTURE_2D_MULTISAMPLE \value Target2DMultisampleArray An array of 2-dimensional textures with multisample support. Equivalent to GL_TEXTURE_2D_MULTISAMPLE_ARRAY \value TargetRectangle A rectangular 2-dimensional texture. Equivalent to GL_TEXTURE_RECTANGLE \value TargetBuffer A texture with data from an OpenGL buffer object. Equivalent to GL_TEXTURE_BUFFER

Enumerator
Target1D 
Target1DArray 
Target2D 
Target2DArray 
Target3D 
TargetCubeMap 
TargetCubeMapArray 
Target2DMultisample 
Target2DMultisampleArray 
TargetRectangle 
TargetBuffer 

Definition at line 25 of file qopengltexture.h.

◆ TextureFormat

This enum defines the possible texture formats.

Depending upon your OpenGL implementation only a subset of these may be supported.

\value NoFormat Equivalent to GL_NONE

\value R8_UNorm Equivalent to GL_R8 \value RG8_UNorm Equivalent to GL_RG8 \value RGB8_UNorm Equivalent to GL_RGB8 \value RGBA8_UNorm Equivalent to GL_RGBA8

\value R16_UNorm Equivalent to GL_R16 \value RG16_UNorm Equivalent to GL_RG16 \value RGB16_UNorm Equivalent to GL_RGB16 \value RGBA16_UNorm Equivalent to GL_RGBA16

\value R8_SNorm Equivalent to GL_R8_SNORM \value RG8_SNorm Equivalent to GL_RG8_SNORM \value RGB8_SNorm Equivalent to GL_RGB8_SNORM \value RGBA8_SNorm Equivalent to GL_RGBA8_SNORM

\value R16_SNorm Equivalent to GL_R16_SNORM \value RG16_SNorm Equivalent to GL_RG16_SNORM \value RGB16_SNorm Equivalent to GL_RGB16_SNORM \value RGBA16_SNorm Equivalent to GL_RGBA16_SNORM

\value R8U Equivalent to GL_R8UI \value RG8U Equivalent to GL_RG8UI \value RGB8U Equivalent to GL_RGB8UI \value RGBA8U Equivalent to GL_RGBA8UI

\value R16U Equivalent to GL_R16UI \value RG16U Equivalent to GL_RG16UI \value RGB16U Equivalent to GL_RGB16UI \value RGBA16U Equivalent to GL_RGBA16UI

\value R32U Equivalent to GL_R32UI \value RG32U Equivalent to GL_RG32UI \value RGB32U Equivalent to GL_RGB32UI \value RGBA32U Equivalent to GL_RGBA32UI

\value R8I Equivalent to GL_R8I \value RG8I Equivalent to GL_RG8I \value RGB8I Equivalent to GL_RGB8I \value RGBA8I Equivalent to GL_RGBA8I

\value R16I Equivalent to GL_R16I \value RG16I Equivalent to GL_RG16I \value RGB16I Equivalent to GL_RGB16I \value RGBA16I Equivalent to GL_RGBA16I

\value R32I Equivalent to GL_R32I \value RG32I Equivalent to GL_RG32I \value RGB32I Equivalent to GL_RGB32I \value RGBA32I Equivalent to GL_RGBA32I

\value R16F Equivalent to GL_R16F \value RG16F Equivalent to GL_RG16F \value RGB16F Equivalent to GL_RGB16F \value RGBA16F Equivalent to GL_RGBA16F

\value R32F Equivalent to GL_R32F \value RG32F Equivalent to GL_RG32F \value RGB32F Equivalent to GL_RGB32F \value RGBA32F Equivalent to GL_RGBA32F

\value RGB9E5 Equivalent to GL_RGB9_E5 \value RG11B10F Equivalent to GL_R11F_G11F_B10F \value RG3B2 Equivalent to GL_R3_G3_B2 \value R5G6B5 Equivalent to GL_RGB565 \value RGB5A1 Equivalent to GL_RGB5_A1 \value RGBA4 Equivalent to GL_RGBA4 \value RGB10A2 Equivalent to GL_RGB10_A2UI

\value D16 Equivalent to GL_DEPTH_COMPONENT16 \value D24 Equivalent to GL_DEPTH_COMPONENT24 \value D24S8 Equivalent to GL_DEPTH24_STENCIL8 \value D32 Equivalent to GL_DEPTH_COMPONENT32 \value D32F Equivalent to GL_DEPTH_COMPONENT32F \value D32FS8X24 Equivalent to GL_DEPTH32F_STENCIL8 \value S8 Equivalent to GL_STENCIL_INDEX8. Introduced in Qt 5.4

\value RGB_DXT1 Equivalent to GL_COMPRESSED_RGB_S3TC_DXT1_EXT \value RGBA_DXT1 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT1_EXT \value RGBA_DXT3 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT3_EXT \value RGBA_DXT5 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT5_EXT \value R_ATI1N_UNorm Equivalent to GL_COMPRESSED_RED_RGTC1 \value R_ATI1N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RED_RGTC1 \value RG_ATI2N_UNorm Equivalent to GL_COMPRESSED_RG_RGTC2 \value RG_ATI2N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG_RGTC2 \value RGB_BP_UNSIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB \value RGB_BP_SIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB \value RGB_BP_UNorm Equivalent to GL_COMPRESSED_RGBA_BPTC_UNORM_ARB \value R11_EAC_UNorm Equivalent to GL_COMPRESSED_R11_EAC \value R11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_R11_EAC \value RG11_EAC_UNorm Equivalent to GL_COMPRESSED_RG11_EAC \value RG11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG11_EAC \value RGB8_ETC2 Equivalent to GL_COMPRESSED_RGB8_ETC2 \value SRGB8_ETC2 Equivalent to GL_COMPRESSED_SRGB8_ETC2 \value RGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 \value SRGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES \value RGBA_ASTC_4x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_4x4_KHR \value RGBA_ASTC_5x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x4_KHR \value RGBA_ASTC_5x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x5_KHR \value RGBA_ASTC_6x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x5_KHR \value RGBA_ASTC_6x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x6_KHR \value RGBA_ASTC_8x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x5_KHR \value RGBA_ASTC_8x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x6_KHR \value RGBA_ASTC_8x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x8_KHR \value RGBA_ASTC_10x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x5_KHR \value RGBA_ASTC_10x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x6_KHR \value RGBA_ASTC_10x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x8_KHR \value RGBA_ASTC_10x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x10_KHR \value RGBA_ASTC_12x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x10_KHR \value RGBA_ASTC_12x12 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x12_KHR \value SRGB8_Alpha8_ASTC_4x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR \value SRGB8_Alpha8_ASTC_5x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR \value SRGB8_Alpha8_ASTC_5x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR \value SRGB8_Alpha8_ASTC_6x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR \value SRGB8_Alpha8_ASTC_6x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR \value SRGB8_Alpha8_ASTC_8x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR \value SRGB8_Alpha8_ASTC_8x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR \value SRGB8_Alpha8_ASTC_8x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR \value SRGB8_Alpha8_ASTC_10x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR \value SRGB8_Alpha8_ASTC_10x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR \value SRGB8_Alpha8_ASTC_10x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR \value SRGB8_Alpha8_ASTC_10x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR \value SRGB8_Alpha8_ASTC_12x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR \value SRGB8_Alpha8_ASTC_12x12 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR

\value SRGB8 Equivalent to GL_SRGB8 \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8 \value SRGB_DXT1 Equivalent to GL_COMPRESSED_SRGB_S3TC_DXT1_EXT \value SRGB_Alpha_DXT1 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB

\value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture) \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only) \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)

Enumerator
NoFormat 
R8_UNorm 
RG8_UNorm 
RGB8_UNorm 
RGBA8_UNorm 
R16_UNorm 
RG16_UNorm 
RGB16_UNorm 
RGBA16_UNorm 
R8_SNorm 
RG8_SNorm 
RGB8_SNorm 
RGBA8_SNorm 
R16_SNorm 
RG16_SNorm 
RGB16_SNorm 
RGBA16_SNorm 
R8U 
RG8U 
RGB8U 
RGBA8U 
R16U 
RG16U 
RGB16U 
RGBA16U 
R32U 
RG32U 
RGB32U 
RGBA32U 
R8I 
RG8I 
RGB8I 
RGBA8I 
R16I 
RG16I 
RGB16I 
RGBA16I 
R32I 
RG32I 
RGB32I 
RGBA32I 
R16F 
RG16F 
RGB16F 
RGBA16F 
R32F 
RG32F 
RGB32F 
RGBA32F 
RGB9E5 
RG11B10F 
RG3B2 
R5G6B5 
RGB5A1 
RGBA4 
RGB10A2 
D16 
D24 
D24S8 
D32 
D32F 
D32FS8X24 
S8 
RGB_DXT1 
RGBA_DXT1 
RGBA_DXT3 
RGBA_DXT5 
R_ATI1N_UNorm 
R_ATI1N_SNorm 
RG_ATI2N_UNorm 
RG_ATI2N_SNorm 
RGB_BP_UNSIGNED_FLOAT 
RGB_BP_SIGNED_FLOAT 
RGB_BP_UNorm 
R11_EAC_UNorm 
R11_EAC_SNorm 
RG11_EAC_UNorm 
RG11_EAC_SNorm 
RGB8_ETC2 
SRGB8_ETC2 
RGB8_PunchThrough_Alpha1_ETC2 
SRGB8_PunchThrough_Alpha1_ETC2 
RGBA8_ETC2_EAC 
SRGB8_Alpha8_ETC2_EAC 
RGB8_ETC1 
RGBA_ASTC_4x4 
RGBA_ASTC_5x4 
RGBA_ASTC_5x5 
RGBA_ASTC_6x5 
RGBA_ASTC_6x6 
RGBA_ASTC_8x5 
RGBA_ASTC_8x6 
RGBA_ASTC_8x8 
RGBA_ASTC_10x5 
RGBA_ASTC_10x6 
RGBA_ASTC_10x8 
RGBA_ASTC_10x10 
RGBA_ASTC_12x10 
RGBA_ASTC_12x12 
SRGB8_Alpha8_ASTC_4x4 
SRGB8_Alpha8_ASTC_5x4 
SRGB8_Alpha8_ASTC_5x5 
SRGB8_Alpha8_ASTC_6x5 
SRGB8_Alpha8_ASTC_6x6 
SRGB8_Alpha8_ASTC_8x5 
SRGB8_Alpha8_ASTC_8x6 
SRGB8_Alpha8_ASTC_8x8 
SRGB8_Alpha8_ASTC_10x5 
SRGB8_Alpha8_ASTC_10x6 
SRGB8_Alpha8_ASTC_10x8 
SRGB8_Alpha8_ASTC_10x10 
SRGB8_Alpha8_ASTC_12x10 
SRGB8_Alpha8_ASTC_12x12 
SRGB8 
SRGB8_Alpha8 
SRGB_DXT1 
SRGB_Alpha_DXT1 
SRGB_Alpha_DXT3 
SRGB_Alpha_DXT5 
SRGB_BP_UNorm 
DepthFormat 
AlphaFormat 
RGBFormat 
RGBAFormat 
LuminanceFormat 
LuminanceAlphaFormat 

Definition at line 67 of file qopengltexture.h.

◆ TextureFormatClass

Enumerator
NoFormatClass 
FormatClass_128Bit 
FormatClass_96Bit 
FormatClass_64Bit 
FormatClass_48Bit 
FormatClass_32Bit 
FormatClass_24Bit 
FormatClass_16Bit 
FormatClass_8Bit 
FormatClass_RGTC1_R 
FormatClass_RGTC2_RG 
FormatClass_BPTC_Unorm 
FormatClass_BPTC_Float 
FormatClass_S3TC_DXT1_RGB 
FormatClass_S3TC_DXT1_RGBA 
FormatClass_S3TC_DXT3_RGBA 
FormatClass_S3TC_DXT5_RGBA 
FormatClass_Unique 

Definition at line 228 of file qopengltexture.h.

◆ TextureUnitReset

This enum defines options ot control texture unit activation.

\value ResetTextureUnit The previous active texture unit will be reset \value DontResetTextureUnit The previous active texture unit will not be rest

Enumerator
ResetTextureUnit 
DontResetTextureUnit 

Definition at line 61 of file qopengltexture.h.

◆ WrapMode

This enum defines the possible texture coordinate wrapping modes.

\value Repeat Texture coordinate is repeated. Equivalent to GL_REPEAT \value MirroredRepeat Texture coordinate is reflected about 0 and 1. Equivalent to GL_MIRRORED_REPEAT \value ClampToEdge Clamps the texture coordinates to [0,1]. Equivalent to GL_CLAMP_TO_EDGE \value ClampToBorder As for ClampToEdge but also blends samples at 0 and 1 with a fixed border color. Equivalent to GL_CLAMP_TO_BORDER

Enumerator
Repeat 
MirroredRepeat 
ClampToEdge 
ClampToBorder 

Definition at line 331 of file qopengltexture.h.

Constructor & Destructor Documentation

◆ QOpenGLTexture() [1/2]

QOpenGLTexture::QOpenGLTexture ( Target target)
explicit

Creates a QOpenGLTexture object that can later be bound to target.

This does not create the underlying OpenGL texture object. Therefore, construction using this constructor does not require a valid current OpenGL context.

Definition at line 2445 of file qopengltexture.cpp.

◆ QOpenGLTexture() [2/2]

QOpenGLTexture::QOpenGLTexture ( const QImage & image,
MipMapGeneration genMipMaps = GenerateMipMaps )
explicit

Creates a QOpenGLTexture object that can later be bound to the 2D texture target and contains the pixel data contained in image.

If you wish to have a chain of mipmaps generated then set genMipMaps to true (this is the default).

This does create the underlying OpenGL texture object. Therefore, construction using this constructor does require a valid current OpenGL context.

Note
image is automatically converted to QImage::Format_RGBA8888 which may have performance implications for large images with a different format.

Definition at line 2463 of file qopengltexture.cpp.

References setData().

+ Here is the call graph for this function:

◆ ~QOpenGLTexture()

QOpenGLTexture::~QOpenGLTexture ( )

Definition at line 2469 of file qopengltexture.cpp.

Member Function Documentation

◆ allocateStorage() [1/2]

void QOpenGLTexture::allocateStorage ( )

Allocates server-side storage for this texture object taking into account, the format, dimensions, mipmap levels, array layers and cubemap faces.

Once storage has been allocated it is no longer possible to change these properties.

If supported QOpenGLTexture makes use of immutable texture storage.

Once storage has been allocated for the texture then pixel data can be uploaded via one of the setData() overloads.

Note
If immutable texture storage is not available, then a default pixel format and pixel type will be used to create the mutable storage. You can use the other allocateStorage() overload to specify exactly the pixel format and the pixel type to use when allocating mutable storage; this is particularly useful under certain OpenGL ES implementations (notably, OpenGL ES 2), where the pixel format and the pixel type used at allocation time must perfectly match the format and the type passed to any subsequent setData() call.
See also
isStorageAllocated(), setData()

Definition at line 3261 of file qopengltexture.cpp.

References d, pixelFormatCompatibleWithInternalFormat(), and pixelTypeCompatibleWithInternalFormat().

Referenced by setData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allocateStorage() [2/2]

void QOpenGLTexture::allocateStorage ( QOpenGLTexture::PixelFormat pixelFormat,
QOpenGLTexture::PixelType pixelType )
Since
5.5

Allocates server-side storage for this texture object taking into account, the format, dimensions, mipmap levels, array layers and cubemap faces.

Once storage has been allocated it is no longer possible to change these properties.

If supported QOpenGLTexture makes use of immutable texture storage. However, if immutable texture storage is not available, then the specified pixelFormat and pixelType will be used to allocate mutable storage; note that in certain OpenGL implementations (notably, OpenGL ES 2) they must perfectly match the format and the type passed to any subsequent setData() call.

Once storage has been allocated for the texture then pixel data can be uploaded via one of the setData() overloads.

See also
isStorageAllocated(), setData()

Definition at line 3293 of file qopengltexture.cpp.

References d.

◆ bind() [1/2]

void QOpenGLTexture::bind ( )

Binds this texture to the currently active texture unit ready for rendering.

Note that you do not need to bind QOpenGLTexture objects in order to modify them as the implementation makes use of the EXT_direct_state_access extension where available and simulates it where it is not.

See also
release()

Definition at line 2551 of file qopengltexture.cpp.

References d, and Q_ASSERT.

Referenced by DrmEglServerBuffer::DrmEglServerBuffer(), LibHybrisEglServerBuffer::LibHybrisEglServerBuffer(), WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(), WaylandEglStreamClientBufferIntegrationPrivate::handleEglstreamTexture(), QtWaylandClient::DmaBufServerBuffer::toOpenGlTexture(), QtWaylandClient::DrmServerBuffer::toOpenGlTexture(), QtWaylandClient::LibHybrisServerBuffer::toOpenGlTexture(), VulkanServerBuffer::toOpenGlTexture(), and BrcmEglClientBuffer::toOpenGlTexture().

+ Here is the caller graph for this function:

◆ bind() [2/2]

void QOpenGLTexture::bind ( uint unit,
TextureUnitReset reset = DontResetTextureUnit )

Binds this texture to texture unit unit ready for rendering.

Note that you do not need to bind QOpenGLTexture objects in order to modify them as the implementation makes use of the EXT_direct_state_access extension where available and simulates it where it is not.

If parameter reset is true then this function will restore the active unit to the texture unit that was active upon entry.

See also
release()

Definition at line 2570 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ borderColor() [1/4]

QColor QOpenGLTexture::borderColor ( ) const

Returns the borderColor of this texture.

See also
setBorderColor()

Definition at line 4587 of file qopengltexture.cpp.

References d.

◆ borderColor() [2/4]

void QOpenGLTexture::borderColor ( float * border) const

Writes the texture border color into the first four elements of the array pointed to by border.

See also
setBorderColor()

Definition at line 4606 of file qopengltexture.cpp.

References d, i, and Q_ASSERT.

◆ borderColor() [3/4]

void QOpenGLTexture::borderColor ( int * border) const

Writes the texture border color into the first four elements of the array pointed to by border.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4625 of file qopengltexture.cpp.

References d, i, and Q_ASSERT.

◆ borderColor() [4/4]

void QOpenGLTexture::borderColor ( unsigned int * border) const

Writes the texture border color into the first four elements of the array pointed to by border.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4644 of file qopengltexture.cpp.

References d, i, and Q_ASSERT.

◆ boundTextureId() [1/2]

GLuint QOpenGLTexture::boundTextureId ( BindingTarget target)
static

Returns the textureId of the texture that is bound to the target of the currently active texture unit.

Definition at line 2631 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), GLint(), GLuint, qWarning, and textureId().

+ Here is the call graph for this function:

◆ boundTextureId() [2/2]

GLuint QOpenGLTexture::boundTextureId ( uint unit,
BindingTarget target )
static

Returns the textureId of the texture that is bound to the target of the texture unit unit.

Definition at line 2648 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), funcs, GL_ACTIVE_TEXTURE, GLint(), GLuint, qWarning, and textureId().

+ Here is the call graph for this function:

◆ comparisonFunction()

QOpenGLTexture::ComparisonFunction QOpenGLTexture::comparisonFunction ( ) const
Since
5.5

Returns the texture comparison operator set on this texture. By default, a texture has a CompareLessEqual comparison function.

See also
setComparisonFunction()

Definition at line 4266 of file qopengltexture.cpp.

References d.

◆ comparisonMode()

QOpenGLTexture::ComparisonMode QOpenGLTexture::comparisonMode ( ) const
Since
5.5

Returns the texture comparison mode set on this texture. By default, a texture has a CompareNone comparison mode (i.e. comparisons are disabled).

See also
setComparisonMode()

Definition at line 4309 of file qopengltexture.cpp.

References d.

◆ create()

bool QOpenGLTexture::create ( )

Creates the underlying OpenGL texture object.

This requires a current valid OpenGL context. If the texture object already exists, this function does nothing.

Once the texture object is created you can obtain the object name from the textureId() function. This may be useful if you wish to make some raw OpenGL calls related to this texture.

Normally it should not be necessary to call this function directly as all functions that set properties of the texture object implicitly call create() on your behalf.

Returns true if the creation succeeded, otherwise returns false.

See also
destroy(), isCreated(), textureId()

Definition at line 2501 of file qopengltexture.cpp.

References d.

Referenced by DrmEglServerBuffer::DrmEglServerBuffer(), LibHybrisEglServerBuffer::LibHybrisEglServerBuffer(), QtWaylandClient::DmaBufServerBuffer::toOpenGlTexture(), QtWaylandClient::DrmServerBuffer::toOpenGlTexture(), QtWaylandClient::LibHybrisServerBuffer::toOpenGlTexture(), VulkanServerBuffer::toOpenGlTexture(), and BrcmEglClientBuffer::toOpenGlTexture().

+ Here is the caller graph for this function:

◆ createTextureView()

QOpenGLTexture * QOpenGLTexture::createTextureView ( Target target,
TextureFormat viewFormat,
int minimumMipmapLevel,
int maximumMipmapLevel,
int minimumLayer,
int maximumLayer ) const

Attempts to create a texture view onto this texture.

A texture view is somewhat analogous to a view in SQL in that it presents a restricted or reinterpreted view of the original data. Texture views do not allocate any more server-side storage, instead relying on the storage buffer of the source texture.

Texture views are only available when using immutable storage. For more information on texture views see http://www.opengl.org/wiki/Texture_Storage#Texture_views.

The target argument specifies the target to use for the view. Only some targets can be used depending upon the target of the original target. For e.g. a view onto a Target1DArray texture can specify either Target1DArray or Target1D but for the latter the number of array layers specified with minimumLayer and maximumLayer must be exactly 1.

Simpliar constraints apply for the viewFormat. See the above link and the specification for more details.

The minimumMipmapLevel, maximumMipmapLevel, minimumLayer, and maximumLayer arguments serve to restrict the parts of the texture accessible by the texture view.

If creation of the texture view fails this function will return 0. If the function succeeds it will return a pointer to a new QOpenGLTexture object that will return true from its isTextureView() function.

See also
isTextureView()

Definition at line 3347 of file qopengltexture.cpp.

References d, isStorageAllocated(), Q_ASSERT, and qWarning.

+ Here is the call graph for this function:

◆ depth()

int QOpenGLTexture::depth ( ) const

Returns the depth of a 3D texture.

See also
width(), height(), setSize()

Definition at line 2977 of file qopengltexture.cpp.

References d.

Referenced by setSize().

+ Here is the caller graph for this function:

◆ depthStencilMode()

QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode ( ) const

Returns the depth stencil mode for textures using a combined depth/stencil format.

Since
5.4
See also
setDepthStencilMode()

Definition at line 4214 of file qopengltexture.cpp.

References d.

◆ destroy()

void QOpenGLTexture::destroy ( )

Destroys the underlying OpenGL texture object.

This requires a current valid OpenGL context.

See also
create(), isCreated(), textureId()

Definition at line 2513 of file qopengltexture.cpp.

References d.

Referenced by VulkanServerBuffer::releaseOpenGlTexture().

+ Here is the caller graph for this function:

◆ faces()

int QOpenGLTexture::faces ( ) const

Returns the number of faces for this texture.

For cubemap and cubemap array type targets this will be 6.

For non-cubemap type targets this will return 1.

Definition at line 3110 of file qopengltexture.cpp.

References d.

◆ format()

QOpenGLTexture::TextureFormat QOpenGLTexture::format ( ) const

Returns the format of this texture object.

See also
setFormat()

Definition at line 2878 of file qopengltexture.cpp.

References d.

Referenced by setFormat().

+ Here is the caller graph for this function:

◆ generateMipMaps() [1/2]

void QOpenGLTexture::generateMipMaps ( )

Generates mipmaps for this texture object from mipmap level 0.

If you are using a texture target and filtering option that requires mipmaps and you have disabled automatic mipmap generation then you need to call this function or the overload to create the mipmap chain.

Note
Mipmap generation is not supported for compressed textures with OpenGL ES.
See also
setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels()

Definition at line 4041 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, isCompressedFormat(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ generateMipMaps() [2/2]

void QOpenGLTexture::generateMipMaps ( int baseLevel,
bool resetBaseLevel = true )

Generates mipmaps for this texture object from mipmap level baseLevel.

If you are using a texture target and filtering option that requires mipmaps and you have disabled automatic mipmap generation then you need to call this function or the overload to create the mipmap chain.

The generation of mipmaps to above baseLevel is achieved by setting the mipmap base level to baseLevel and then generating the mipmap chain. If resetBaseLevel is true, then the baseLevel of the texture will be reset to its previous value.

See also
setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels()

Definition at line 4066 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, isCompressedFormat(), mipBaseLevel(), Q_ASSERT, and setMipBaseLevel().

+ Here is the call graph for this function:

◆ hasFeature()

bool QOpenGLTexture::hasFeature ( Feature feature)
static

Returns true if your OpenGL implementation and version supports the texture feature feature.

Definition at line 3735 of file qopengltexture.cpp.

References AnisotropicFiltering, QOpenGLContext::currentContext(), ImmutableMultisampleStorage, ImmutableStorage, MaxFeatureFlag, NPOTTextureRepeat, NPOTTextures, QByteArrayLiteral, qMakePair(), qWarning, renderer, StencilTexturing, Swizzle, Texture1D, Texture3D, TextureArrays, TextureBuffer, TextureComparisonOperators, TextureCubeMapArrays, TextureMipMapLevel, TextureMultisample, TextureRectangle, and QSurfaceFormat::version().

Referenced by QOpenGLTexturePrivate::create(), and setSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ height()

int QOpenGLTexture::height ( ) const

Returns the height of a 2D or 3D texture.

See also
width(), depth(), setSize()

Definition at line 2966 of file qopengltexture.cpp.

References d.

Referenced by setSize().

+ Here is the caller graph for this function:

◆ isAutoMipMapGenerationEnabled()

bool QOpenGLTexture::isAutoMipMapGenerationEnabled ( ) const

Returns whether auto mipmap generation is enabled for this texture object.

See also
setAutoMipMapGenerationEnabled(), generateMipMaps()

Definition at line 4025 of file qopengltexture.cpp.

References d.

◆ isBound() [1/2]

bool QOpenGLTexture::isBound ( ) const

Returns true if this texture is bound to the corresponding target of the currently active texture unit.

See also
bind(), release()

Definition at line 2607 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ isBound() [2/2]

bool QOpenGLTexture::isBound ( uint unit)

Returns true if this texture is bound to the corresponding target of texture unit unit.

See also
bind(), release()

Definition at line 2620 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ isCreated()

bool QOpenGLTexture::isCreated ( ) const

Returns true if the underlying OpenGL texture object has been created.

See also
create(), destroy(), textureId()

Definition at line 2524 of file qopengltexture.cpp.

References d.

Referenced by VulkanServerBuffer::bufferInUse(), VulkanServerBuffer::releaseOpenGlTexture(), and VulkanServerBuffer::toOpenGlTexture().

+ Here is the caller graph for this function:

◆ isFixedSamplePositions()

bool QOpenGLTexture::isFixedSamplePositions ( ) const

Returns whether this texture uses a fixed pattern of multisample samples.

If storage has not yet been allocated for this texture then this function returns the requested fixed sample position setting.

For texture targets that do not support multisampling this will return true.

See also
setFixedSamplePositions(), isStorageAllocated()

Definition at line 3229 of file qopengltexture.cpp.

References d.

◆ isStorageAllocated()

bool QOpenGLTexture::isStorageAllocated ( ) const

Returns true if server-side storage for this texture as been allocated.

The texture format, dimensions, mipmap levels and array layers cannot be altered once storage ihas been allocated.

See also
allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat()

Definition at line 3309 of file qopengltexture.cpp.

References d.

Referenced by createTextureView(), mipLevels(), setCompressedData(), setCompressedData(), setData(), setData(), setFixedSamplePositions(), setFormat(), setLayers(), setMipLevels(), setSamples(), and setSize().

+ Here is the caller graph for this function:

◆ isTextureView()

bool QOpenGLTexture::isTextureView ( ) const

Returns true if this texture object is actually a view onto another texture object.

See also
createTextureView()

Definition at line 3370 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ layers()

int QOpenGLTexture::layers ( ) const

Returns the number of array layers for this texture.

If storage has not yet been allocated for this texture then this function returns the requested number of array layers.

For texture targets that do not support array layers this will return 1.

See also
setLayers(), isStorageAllocated()

Definition at line 3098 of file qopengltexture.cpp.

References d.

Referenced by setLayers().

+ Here is the caller graph for this function:

◆ levelofDetailBias()

float QOpenGLTexture::levelofDetailBias ( ) const

Returns the level of detail bias parameter.

See also
setLevelofDetailBias()

Definition at line 4802 of file qopengltexture.cpp.

References d.

◆ levelOfDetailRange()

QPair< float, float > QOpenGLTexture::levelOfDetailRange ( ) const

Returns the minimum and maximum level of detail parameters.

See also
setLevelOfDetailRange(), minimumLevelOfDetail(), maximumLevelOfDetail()

Definition at line 4764 of file qopengltexture.cpp.

References d, and qMakePair().

+ Here is the call graph for this function:

◆ magnificationFilter()

QOpenGLTexture::Filter QOpenGLTexture::magnificationFilter ( ) const

Returns the magnification filter.

See also
setMagnificationFilter()

Definition at line 4361 of file qopengltexture.cpp.

References d.

Referenced by setMinMagFilters().

+ Here is the caller graph for this function:

◆ maximumAnisotropy()

float QOpenGLTexture::maximumAnisotropy ( ) const

Returns the maximum level of anisotropy to be accounted for when performing texture lookups.

This requires the GL_EXT_texture_filter_anisotropic extension.

See also
setMaximumAnisotropy()

Definition at line 4423 of file qopengltexture.cpp.

References d.

◆ maximumLevelOfDetail()

float QOpenGLTexture::maximumLevelOfDetail ( ) const

Returns the maximum level of detail parameter.

See also
setMaximumLevelOfDetail(), minimumLevelOfDetail(), levelOfDetailRange()

Definition at line 4725 of file qopengltexture.cpp.

References d.

◆ maximumMipLevels()

int QOpenGLTexture::maximumMipLevels ( ) const

Returns the maximum number of mipmap levels that this texture can have given the current dimensions.

See also
setMipLevels(), mipLevels(), setSize()

Definition at line 3043 of file qopengltexture.cpp.

References d.

Referenced by setData().

+ Here is the caller graph for this function:

◆ minificationFilter()

QOpenGLTexture::Filter QOpenGLTexture::minificationFilter ( ) const

Returns the minification filter.

See also
setMinificationFilter()

Definition at line 4335 of file qopengltexture.cpp.

References d.

Referenced by setMinMagFilters().

+ Here is the caller graph for this function:

◆ minimumLevelOfDetail()

float QOpenGLTexture::minimumLevelOfDetail ( ) const

Returns the minimum level of detail parameter.

See also
setMinimumLevelOfDetail(), maximumLevelOfDetail(), levelOfDetailRange()

Definition at line 4688 of file qopengltexture.cpp.

References d.

◆ minMagFilters()

QPair< QOpenGLTexture::Filter, QOpenGLTexture::Filter > QOpenGLTexture::minMagFilters ( ) const

Returns the current minification and magnification filters.

See also
setMinMagFilters()

Definition at line 4391 of file qopengltexture.cpp.

References d.

◆ mipBaseLevel()

int QOpenGLTexture::mipBaseLevel ( ) const

Returns the mipmap base level used for all texture lookups with this texture.

The default is 0.

See also
setMipBaseLevel(), mipMaxLevel(), mipLevelRange()

Definition at line 3933 of file qopengltexture.cpp.

References d.

Referenced by generateMipMaps().

+ Here is the caller graph for this function:

◆ mipLevelRange()

QPair< int, int > QOpenGLTexture::mipLevelRange ( ) const

Returns the range of mipmap levels that can be used for texture lookups with this texture.

See also
mipBaseLevel(), mipMaxLevel()

Definition at line 3998 of file qopengltexture.cpp.

References d, and qMakePair().

+ Here is the call graph for this function:

◆ mipLevels()

int QOpenGLTexture::mipLevels ( ) const

Returns the number of mipmap levels for this texture.

If storage has not yet been allocated for this texture it returns the requested number of mipmap levels.

See also
setMipLevels(), maximumMipLevels(), isStorageAllocated()

Definition at line 3031 of file qopengltexture.cpp.

References d, and isStorageAllocated().

+ Here is the call graph for this function:

◆ mipMaxLevel()

int QOpenGLTexture::mipMaxLevel ( ) const

Returns the mipmap maximum level used for all texture lookups with this texture.

See also
setMipMaxLevel(), mipBaseLevel(), mipLevelRange()

Definition at line 3965 of file qopengltexture.cpp.

References d.

◆ release() [1/2]

void QOpenGLTexture::release ( )

Unbinds this texture from the currently active texture unit.

See also
bind()

Definition at line 2582 of file qopengltexture.cpp.

References d.

Referenced by DmaBufServerBuffer::DmaBufServerBuffer(), DrmEglServerBuffer::DrmEglServerBuffer(), LibHybrisEglServerBuffer::LibHybrisEglServerBuffer(), QtWaylandClient::DmaBufServerBuffer::toOpenGlTexture(), QtWaylandClient::DrmServerBuffer::toOpenGlTexture(), and QtWaylandClient::LibHybrisServerBuffer::toOpenGlTexture().

+ Here is the caller graph for this function:

◆ release() [2/2]

void QOpenGLTexture::release ( uint unit,
TextureUnitReset reset = DontResetTextureUnit )

Unbinds this texture from texture unit unit.

If parameter reset is true then this function will restore the active unit to the texture unit that was active upon entry.

Definition at line 2595 of file qopengltexture.cpp.

References d.

◆ samples()

int QOpenGLTexture::samples ( ) const

Returns the number of multisample sample points for this texture.

If storage has not yet been allocated for this texture then this function returns the requested number of samples.

For texture targets that do not support multisampling this will return 0.

See also
setSamples(), isStorageAllocated()

Definition at line 3167 of file qopengltexture.cpp.

References d.

Referenced by setSamples().

+ Here is the caller graph for this function:

◆ setAutoMipMapGenerationEnabled()

void QOpenGLTexture::setAutoMipMapGenerationEnabled ( bool enabled)

If enabled is true, enables automatic mipmap generation for this texture object to occur whenever the level 0 mipmap data is set via setData().

The automatic mipmap generation is enabled by default.

Note
Mipmap generation is not supported for compressed textures with OpenGL ES 2.0.
See also
isAutoMipMapGenerationEnabled(), generateMipMaps()

Definition at line 4014 of file qopengltexture.cpp.

References d, and enabled.

◆ setBorderColor() [1/4]

void QOpenGLTexture::setBorderColor ( const QColor & color)

Sets the border color of the texture to color.

Note
This function has no effect on Mac and Qt built for OpenGL ES 2.
See also
borderColor()

Definition at line 4473 of file qopengltexture.cpp.

References setBorderColor().

Referenced by setBorderColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBorderColor() [2/4]

void QOpenGLTexture::setBorderColor ( float r,
float g,
float b,
float a )

Sets the color red to {r}, green to {g}, blue to {b}, and {a} to the alpha value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4484 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, i, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setBorderColor() [3/4]

void QOpenGLTexture::setBorderColor ( int r,
int g,
int b,
int a )

Sets the color red to {r}, green to {g}, blue to {b}, and the alpha value to {a}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4517 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, i, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setBorderColor() [4/4]

void QOpenGLTexture::setBorderColor ( uint r,
uint g,
uint b,
uint a )

Sets the color red to {r}, green to {g}, blue to {b}, and the alpha value to {a}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4552 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, i, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setComparisonFunction()

void QOpenGLTexture::setComparisonFunction ( QOpenGLTexture::ComparisonFunction function)
Since
5.5

Sets the texture comparison function on this texture to function. The texture comparison function is used by shadow samplers when sampling a depth texture.

See also
comparisonFunction()

Definition at line 4246 of file qopengltexture.cpp.

References d, function, GL_TEXTURE_COMPARE_FUNC, qWarning, and TextureComparisonOperators.

◆ setComparisonMode()

void QOpenGLTexture::setComparisonMode ( QOpenGLTexture::ComparisonMode mode)
Since
5.5

Sets the texture comparison mode on this texture to mode. The texture comparison mode is used by shadow samplers when sampling a depth texture.

See also
comparisonMode()

Definition at line 4289 of file qopengltexture.cpp.

References d, GL_TEXTURE_COMPARE_MODE, qWarning, and TextureComparisonOperators.

◆ setCompressedData() [1/5]

void QOpenGLTexture::setCompressedData ( int dataSize,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3723 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setCompressedData() [2/5]

void QOpenGLTexture::setCompressedData ( int mipLevel,
int dataSize,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3712 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setCompressedData() [3/5]

void QOpenGLTexture::setCompressedData ( int mipLevel,
int layer,
CubeMapFace cubeFace,
int dataSize,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )

Uploads compressed pixel data to mipLevel, array layer, and cubeFace.

The pixel transfer can optionally be controlled with options. The dataSize argument should specify the size of the data pointed to by data.

If not using a compressed format() then you should use setData() instead of this function.

Since
5.3

Definition at line 3665 of file qopengltexture.cpp.

References d, isStorageAllocated(), Q_ASSERT, and qWarning.

+ Here is the call graph for this function:

◆ setCompressedData() [4/5]

void QOpenGLTexture::setCompressedData ( int mipLevel,
int layer,
int dataSize,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3701 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setCompressedData() [5/5]

void QOpenGLTexture::setCompressedData ( int mipLevel,
int layer,
int layerCount,
QOpenGLTexture::CubeMapFace cubeFace,
int dataSize,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.9 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameter layerCount is the number of layers in a texture array that are being uploaded/populated by this call.

Definition at line 3686 of file qopengltexture.cpp.

References d, isStorageAllocated(), Q_ASSERT, and qWarning.

+ Here is the call graph for this function:

◆ setData() [1/11]

void QOpenGLTexture::setData ( const QImage & image,
MipMapGeneration genMipMaps = GenerateMipMaps )

This overload of setData() will allocate storage for you.

The pixel data is contained in image. Mipmaps are generated by default. Set genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation.

Note
image is automatically converted to QImage::Format_RGBA8888 which may have performance implications for large images with a different format.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3621 of file qopengltexture.cpp.

References allocateStorage(), context, QOpenGLContext::currentContext(), QImage::Format_RGBA8888, GenerateMipMaps, maximumMipLevels(), qWarning, RGBA, RGBA8_UNorm, RGBAFormat, QOpenGLPixelTransferOptions::setAlignment(), setData(), setFormat(), setMipLevels(), setSize(), and UInt8.

+ Here is the call graph for this function:

◆ setData() [2/11]

void QOpenGLTexture::setData ( int mipLevel,
int layer,
CubeMapFace cubeFace,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )

Uploads pixel data for this texture object mipLevel, array layer, and cubeFace.

Storage must have been allocated before uploading pixel data. Some overloads of setData() will set appropriate dimensions, mipmap levels, and array layers and then allocate storage for you if they have enough information to do so. This will be noted in the function documentation.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

If using a compressed format() then you should use setCompressedData() instead of this function.

Since
5.3
See also
setCompressedData()

Definition at line 3393 of file qopengltexture.cpp.

References d, isStorageAllocated(), Q_ASSERT, and qWarning.

Referenced by QOpenGLTexture(), and setData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setData() [3/11]

void QOpenGLTexture::setData ( int mipLevel,
int layer,
int layerCount,
QOpenGLTexture::CubeMapFace cubeFace,
QOpenGLTexture::PixelFormat sourceFormat,
QOpenGLTexture::PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.9 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameter layerCount is the number of layers in a texture array that are being uploaded/populated by this call.

Definition at line 3414 of file qopengltexture.cpp.

References d, isStorageAllocated(), Q_ASSERT, and qWarning.

+ Here is the call graph for this function:

◆ setData() [4/11]

void QOpenGLTexture::setData ( int mipLevel,
int layer,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.3 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3430 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setData() [5/11]

void QOpenGLTexture::setData ( int mipLevel,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.3 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3443 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setData() [6/11]

void QOpenGLTexture::setData ( int xOffset,
int yOffset,
int zOffset,
int width,
int height,
int depth,
int mipLevel,
int layer,
CubeMapFace face,
int layerCount,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.14 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload is to be used to update a part of the texture. Parameters xOffset, yOffset, zOffset specify the texel offsets within the texture. Parameters width, height and depth specify the dimensions of the sub image.The mip map level, starting layer, cube map face and number of layers of the sub image we want to update are specified with mipLevel, layer, face and layerCount.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

Definition at line 3595 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ setData() [7/11]

void QOpenGLTexture::setData ( int xOffset,
int yOffset,
int zOffset,
int width,
int height,
int depth,
int mipLevel,
int layer,
CubeMapFace face,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.14 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload is to be used to update a part of the texture. Parameters xOffset, yOffset, zOffset specify the texel offsets within the texture. Parameters width, height and depth specify the dimensions of the sub image.The mip map level, layer and cube map face of the sub image we want to update are specified with mipLevel, layer and face.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

Definition at line 3564 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ setData() [8/11]

void QOpenGLTexture::setData ( int xOffset,
int yOffset,
int zOffset,
int width,
int height,
int depth,
int mipLevel,
int layer,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.14 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload is to be used to update a part of the texture. Parameters xOffset, yOffset, zOffset specify the texel offsets within the texture. Parameters width, height and depth specify the dimensions of the sub image. The mip map level and layerof the sub image we want to update are specified with mipLevel and layer.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

Definition at line 3534 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setData() [9/11]

void QOpenGLTexture::setData ( int xOffset,
int yOffset,
int zOffset,
int width,
int height,
int depth,
int mipLevel,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.14 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload is to be used to update a part of the texture. Parameters xOffset, yOffset, zOffset specify the texel offsets within the texture. Parameters width, height and depth specify the dimensions of the sub image. The mip map level the sub image we want to update is specified with mipLevel.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

Definition at line 3505 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setData() [10/11]

void QOpenGLTexture::setData ( int xOffset,
int yOffset,
int zOffset,
int width,
int height,
int depth,
PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.14 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload is to be used to update a part of the texture. Parameters xOffset, yOffset, zOffset specify the texel offsets within the texture. Parameters width, height and depth specify the dimensions of the sub image.

The structure of the pixel data pointed to by data is specified by sourceFormat and sourceType. The pixel data upload can optionally be controlled by options.

Definition at line 3477 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setData() [11/11]

void QOpenGLTexture::setData ( PixelFormat sourceFormat,
PixelType sourceType,
const void * data,
const QOpenGLPixelTransferOptions *const options = nullptr )
Since
5.3 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3456 of file qopengltexture.cpp.

References CubeMapPositiveX, d, and Q_ASSERT.

◆ setDepthStencilMode()

void QOpenGLTexture::setDepthStencilMode ( QOpenGLTexture::DepthStencilMode mode)

If using a texture that has a combined depth/stencil format this function sets which component of the texture is accessed to mode.

When the parameter is set to DepthMode, then accessing it from the shader will access the depth component as a single float, as normal. But when the parameter is set to StencilMode, the shader will access the stencil component.

Note
This function has no effect on Mac and Qt built for OpenGL ES 2.
Since
5.4
See also
depthStencilMode()

Definition at line 4186 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_DEPTH_STENCIL_TEXTURE_MODE, Q_ASSERT, Q_UNUSED, qWarning, and StencilTexturing.

+ Here is the call graph for this function:

◆ setFixedSamplePositions()

void QOpenGLTexture::setFixedSamplePositions ( bool fixed)

Sets whether the sample positions and number of samples used with a multisample capable texture target to fixed.

If set to true the sample positions and number of samples used are the same for all texels in the image and will not depend upon the image size or internal format. This function should be called before storage is allocated for the texture.

For targets that do not support multisampling this function has no effect.

The default value is true.

See also
isFixedSamplePositions(), isStorageAllocated()

Definition at line 3188 of file qopengltexture.cpp.

References d, isStorageAllocated(), qWarning, Target1D, Target1DArray, Target2D, Target2DArray, Target2DMultisample, Target2DMultisampleArray, Target3D, TargetBuffer, TargetCubeMap, TargetCubeMapArray, and TargetRectangle.

+ Here is the call graph for this function:

◆ setFormat()

void QOpenGLTexture::setFormat ( TextureFormat format)

Sets the format of this texture object to format.

This function must be called before texture storage is allocated.

Note that all formats may not be supported. The exact set of supported formats is dependent upon your OpenGL implementation and version.

See also
format(), allocateStorage()

Definition at line 2679 of file qopengltexture.cpp.

References AlphaFormat, d, D16, D24, D24S8, D32, D32F, D32FS8X24, DepthFormat, format(), FormatClass_128Bit, FormatClass_16Bit, FormatClass_24Bit, FormatClass_32Bit, FormatClass_48Bit, FormatClass_64Bit, FormatClass_8Bit, FormatClass_96Bit, FormatClass_BPTC_Float, FormatClass_BPTC_Unorm, FormatClass_RGTC1_R, FormatClass_RGTC2_RG, FormatClass_S3TC_DXT1_RGB, FormatClass_S3TC_DXT1_RGBA, FormatClass_S3TC_DXT3_RGBA, FormatClass_S3TC_DXT5_RGBA, FormatClass_Unique, isStorageAllocated(), LuminanceAlphaFormat, LuminanceFormat, NoFormat, NoFormatClass, qWarning, R11_EAC_SNorm, R11_EAC_UNorm, R16_SNorm, R16_UNorm, R16F, R16I, R16U, R32F, R32I, R32U, R5G6B5, R8_SNorm, R8_UNorm, R8I, R8U, R_ATI1N_SNorm, R_ATI1N_UNorm, RG11_EAC_SNorm, RG11_EAC_UNorm, RG11B10F, RG16_SNorm, RG16_UNorm, RG16F, RG16I, RG16U, RG32F, RG32I, RG32U, RG3B2, RG8_SNorm, RG8_UNorm, RG8I, RG8U, RG_ATI2N_SNorm, RG_ATI2N_UNorm, RGB10A2, RGB16_SNorm, RGB16_UNorm, RGB16F, RGB16I, RGB16U, RGB32F, RGB32I, RGB32U, RGB5A1, RGB8_ETC1, RGB8_ETC2, RGB8_PunchThrough_Alpha1_ETC2, RGB8_SNorm, RGB8_UNorm, RGB8I, RGB8U, RGB9E5, RGB_BP_SIGNED_FLOAT, RGB_BP_UNorm, RGB_BP_UNSIGNED_FLOAT, RGB_DXT1, RGBA16_SNorm, RGBA16_UNorm, RGBA16F, RGBA16I, RGBA16U, RGBA32F, RGBA32I, RGBA32U, RGBA4, RGBA8_ETC2_EAC, RGBA8_SNorm, RGBA8_UNorm, RGBA8I, RGBA8U, RGBA_ASTC_10x10, RGBA_ASTC_10x5, RGBA_ASTC_10x6, RGBA_ASTC_10x8, RGBA_ASTC_12x10, RGBA_ASTC_12x12, RGBA_ASTC_4x4, RGBA_ASTC_5x4, RGBA_ASTC_5x5, RGBA_ASTC_6x5, RGBA_ASTC_6x6, RGBA_ASTC_8x5, RGBA_ASTC_8x6, RGBA_ASTC_8x8, RGBA_DXT1, RGBA_DXT3, RGBA_DXT5, RGBAFormat, RGBFormat, S8, SRGB8, SRGB8_Alpha8, SRGB8_Alpha8_ASTC_10x10, SRGB8_Alpha8_ASTC_10x5, SRGB8_Alpha8_ASTC_10x6, SRGB8_Alpha8_ASTC_10x8, SRGB8_Alpha8_ASTC_12x10, SRGB8_Alpha8_ASTC_12x12, SRGB8_Alpha8_ASTC_4x4, SRGB8_Alpha8_ASTC_5x4, SRGB8_Alpha8_ASTC_5x5, SRGB8_Alpha8_ASTC_6x5, SRGB8_Alpha8_ASTC_6x6, SRGB8_Alpha8_ASTC_8x5, SRGB8_Alpha8_ASTC_8x6, SRGB8_Alpha8_ASTC_8x8, SRGB8_Alpha8_ETC2_EAC, SRGB8_ETC2, SRGB8_PunchThrough_Alpha1_ETC2, SRGB_Alpha_DXT1, SRGB_Alpha_DXT3, SRGB_Alpha_DXT5, SRGB_BP_UNorm, and SRGB_DXT1.

Referenced by setData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLayers()

void QOpenGLTexture::setLayers ( int layers)

Sets the number of array layers to allocate storage for.

This function should be called before storage is allocated for the texture.

For targets that do not support array layers this function has no effect.

See also
layers(), isStorageAllocated()

Definition at line 3058 of file qopengltexture.cpp.

References d, isStorageAllocated(), layers(), qWarning, Target1D, Target1DArray, Target2D, Target2DArray, Target2DMultisample, Target2DMultisampleArray, Target3D, TargetBuffer, TargetCubeMap, TargetCubeMapArray, and TargetRectangle.

+ Here is the call graph for this function:

◆ setLevelofDetailBias()

void QOpenGLTexture::setLevelofDetailBias ( float bias)

Sets the level of detail bias to bias.

Level of detail bias affects the point at which mipmapping levels change. Increasing values for level of detail bias makes the overall images blurrier or smoother. Decreasing values make the overall images sharper.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
levelofDetailBias()

Definition at line 4779 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_TEXTURE_LOD_BIAS, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setLevelOfDetailRange()

void QOpenGLTexture::setLevelOfDetailRange ( float min,
float max )

Sets the minimum level of detail parameters to min and the maximum level to max.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail()

Definition at line 4737 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_TEXTURE_MAX_LOD, GL_TEXTURE_MIN_LOD, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setMagnificationFilter()

void QOpenGLTexture::setMagnificationFilter ( QOpenGLTexture::Filter filter)

Sets the magnification filter to filter.

See also
magnificationFilter(), setMinificationFilter(), setMinMagFilters()

Definition at line 4346 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ setMaximumAnisotropy()

void QOpenGLTexture::setMaximumAnisotropy ( float anisotropy)

If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension this function sets the maximum anisotropy level to anisotropy.

See also
maximumAnisotropy()

Definition at line 4403 of file qopengltexture.cpp.

References AnisotropicFiltering, d, GL_TEXTURE_MAX_ANISOTROPY_EXT, Q_ASSERT, and qWarning.

◆ setMaximumLevelOfDetail()

void QOpenGLTexture::setMaximumLevelOfDetail ( float value)

Sets the maximum level of detail to value.

This limits the selection of lowest resolution mipmap (highest mipmap level). The default value is 1000.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange()

Definition at line 4701 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_TEXTURE_MAX_LOD, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setMinificationFilter()

void QOpenGLTexture::setMinificationFilter ( QOpenGLTexture::Filter filter)

Sets the filter used for minification to filter.

See also
minificationFilter(), setMagnificationFilter(), setMinMagFilters()

Definition at line 4320 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ setMinimumLevelOfDetail()

void QOpenGLTexture::setMinimumLevelOfDetail ( float value)

Sets the minimum level of detail to value.

This limits the selection of highest resolution mipmap (lowest mipmap level). The default value is -1000.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange()

Definition at line 4664 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_TEXTURE_MIN_LOD, Q_ASSERT, Q_UNUSED, and qWarning.

+ Here is the call graph for this function:

◆ setMinMagFilters()

void QOpenGLTexture::setMinMagFilters ( QOpenGLTexture::Filter minificationFilter,
QOpenGLTexture::Filter magnificationFilter )

Sets the minification filter to minificationFilter and the magnification filter to magnificationFilter.

See also
minMagFilters(), setMinificationFilter(), setMagnificationFilter()

Definition at line 4373 of file qopengltexture.cpp.

References d, magnificationFilter(), minificationFilter(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ setMipBaseLevel()

void QOpenGLTexture::setMipBaseLevel ( int baseLevel)

Sets the base mipmap level used for all texture lookups with this texture to baseLevel.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
mipBaseLevel(), setMipMaxLevel(), setMipLevelRange()

Definition at line 3912 of file qopengltexture.cpp.

References d, GL_TEXTURE_BASE_LEVEL, Q_ASSERT, qWarning, and TextureMipMapLevel.

Referenced by generateMipMaps().

+ Here is the caller graph for this function:

◆ setMipLevelRange()

void QOpenGLTexture::setMipLevelRange ( int baseLevel,
int maxLevel )

Sets the range of mipmap levels that can be used for texture lookups with this texture to range from baseLevel to maxLevel.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
setMipBaseLevel(), setMipMaxLevel(), mipLevelRange()

Definition at line 3978 of file qopengltexture.cpp.

References d, GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL, Q_ASSERT, qWarning, and TextureMipMapLevel.

◆ setMipLevels()

void QOpenGLTexture::setMipLevels ( int levels)

For texture targets that support mipmaps, this function sets the requested number of mipmap levels to allocate storage for.

This function should be called before storage is allocated for the texture.

If the texture target does not support mipmaps this function has no effect.

See also
mipLevels(), maximumMipLevels(), isStorageAllocated()

Definition at line 2994 of file qopengltexture.cpp.

References d, isStorageAllocated(), qWarning, Target1D, Target1DArray, Target2D, Target2DArray, Target2DMultisample, Target2DMultisampleArray, Target3D, TargetBuffer, TargetCubeMap, TargetCubeMapArray, and TargetRectangle.

Referenced by setData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMipMaxLevel()

void QOpenGLTexture::setMipMaxLevel ( int maxLevel)

Sets the maximum mipmap level used for all texture lookups with this texture to maxLevel.

Note
This function has no effect on Qt built for OpenGL ES 2.
See also
mipMaxLevel(), setMipBaseLevel(), setMipLevelRange()

Definition at line 3945 of file qopengltexture.cpp.

References d, GL_TEXTURE_MAX_LEVEL, Q_ASSERT, qWarning, and TextureMipMapLevel.

◆ setSamples()

void QOpenGLTexture::setSamples ( int samples)

Sets the number of samples to allocate storage for when rendering to a multisample capable texture target.

This function should be called before storage is allocated for the texture.

For targets that do not support multisampling this function has no effect.

See also
samples(), isStorageAllocated()

Definition at line 3126 of file qopengltexture.cpp.

References d, isStorageAllocated(), qWarning, samples(), Target1D, Target1DArray, Target2D, Target2DArray, Target2DMultisample, Target2DMultisampleArray, Target3D, TargetBuffer, TargetCubeMap, TargetCubeMapArray, and TargetRectangle.

+ Here is the call graph for this function:

◆ setSize()

void QOpenGLTexture::setSize ( int width,
int height = 1,
int depth = 1 )

Sets the dimensions of this texture object to width, height, and depth.

The default for each dimension is 1. The maximum allowable texture size is dependent upon your OpenGL implementation. Allocating storage for a texture less than the maximum size can still fail if your system is low on resources.

If a non-power-of-two width, height or depth is provided and your OpenGL implementation doesn't have support for repeating non-power-of-two textures, then the wrap mode is automatically set to ClampToEdge.

See also
width(), height(), depth()

Definition at line 2902 of file qopengltexture.cpp.

References ClampToEdge, d, depth(), hasFeature(), height(), isNpot(), isStorageAllocated(), NPOTTextureRepeat, Q_UNUSED, qWarning, Target1D, Target1DArray, Target2D, Target2DArray, Target2DMultisample, Target2DMultisampleArray, Target3D, TargetBuffer, TargetCubeMap, TargetCubeMapArray, TargetRectangle, and width().

Referenced by DrmEglServerBuffer::DrmEglServerBuffer(), LibHybrisEglServerBuffer::LibHybrisEglServerBuffer(), setData(), QtWaylandClient::DmaBufServerBuffer::toOpenGlTexture(), QtWaylandClient::DrmServerBuffer::toOpenGlTexture(), and QtWaylandClient::LibHybrisServerBuffer::toOpenGlTexture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSwizzleMask() [1/2]

void QOpenGLTexture::setSwizzleMask ( SwizzleComponent component,
SwizzleValue value )

GLSL shaders are able to reorder the components of the vec4 returned by texture functions.

It is also desirable to be able to control this reordering from CPU side code. This is made possible by swizzle masks since OpenGL 3.3.

Each component of the texture can be mapped to one of the SwizzleValue options.

This function maps component to the output value.

Note
This function has no effect on Mac and Qt built for OpenGL ES 2.
See also
swizzleMask()

Definition at line 4097 of file qopengltexture.cpp.

References component(), QOpenGLContext::currentContext(), d, Q_ASSERT, Q_UNUSED, qWarning, Swizzle, and SwizzleRed.

+ Here is the call graph for this function:

◆ setSwizzleMask() [2/2]

void QOpenGLTexture::setSwizzleMask ( SwizzleValue r,
SwizzleValue g,
SwizzleValue b,
SwizzleValue a )

Parameters {r}, {g}, {b}, and {a} are values used for setting the colors red, green, blue, and the alpha value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4125 of file qopengltexture.cpp.

References QOpenGLContext::currentContext(), d, GL_TEXTURE_SWIZZLE_RGBA, GLint(), Q_ASSERT, Q_UNUSED, qWarning, Swizzle, and swizzleMask().

+ Here is the call graph for this function:

◆ setWrapMode() [1/2]

void QOpenGLTexture::setWrapMode ( QOpenGLTexture::CoordinateDirection direction,
QOpenGLTexture::WrapMode mode )

Holds the texture dimension direction.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4447 of file qopengltexture.cpp.

References d, direction, and Q_ASSERT.

◆ setWrapMode() [2/2]

void QOpenGLTexture::setWrapMode ( QOpenGLTexture::WrapMode mode)

Sets the wrap (or repeat mode) for all texture dimensions to mode.

See also
wrapMode()

Definition at line 4434 of file qopengltexture.cpp.

References d, and Q_ASSERT.

◆ swizzleMask()

QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask ( SwizzleComponent component) const

Returns the swizzle mask for texture component.

Definition at line 4158 of file qopengltexture.cpp.

References component(), d, and SwizzleRed.

Referenced by setSwizzleMask().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ target()

QOpenGLTexture::Target QOpenGLTexture::target ( ) const

Returns the binding target of this texture.

Since
5.4

Definition at line 2478 of file qopengltexture.cpp.

References d.

◆ textureId()

GLuint QOpenGLTexture::textureId ( ) const

Returns the name of the underlying OpenGL texture object or 0 if it has not yet been created.

See also
create(), destroy(), isCreated()

Definition at line 2536 of file qopengltexture.cpp.

References d.

Referenced by DmaBufServerBuffer::DmaBufServerBuffer(), boundTextureId(), boundTextureId(), and VulkanServerBuffer::toOpenGlTexture().

+ Here is the caller graph for this function:

◆ width()

int QOpenGLTexture::width ( ) const

Returns the width of a 1D, 2D or 3D texture.

See also
height(), depth(), setSize()

Definition at line 2955 of file qopengltexture.cpp.

References d.

Referenced by setSize().

+ Here is the caller graph for this function:

◆ wrapMode()

QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode ( QOpenGLTexture::CoordinateDirection direction) const

Returns the wrap mode for the texture dimension direction.

See also
setWrapMode()

Definition at line 4461 of file qopengltexture.cpp.

References d, and direction.

Friends And Related Symbol Documentation

◆ operator<<

Q_OPENGL_EXPORT QDebug operator<< ( QDebug dbg,
const QOpenGLTexture * t )
friend

Definition at line 4809 of file qopengltexture.cpp.


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