本页内容

QOpenGLTexture Class

QOpenGLTexture 类封装了一个 OpenGL 纹理对象。更多内容...

Header: #include <QOpenGLTexture>

公共类型

enum BindingTarget { BindingTarget1D, BindingTarget1DArray, BindingTarget2D, BindingTarget2DArray, BindingTarget3D, …, BindingTargetBuffer }
enum ComparisonFunction { CompareLessEqual, CompareGreaterEqual, CompareLess, CompareGreater, CompareEqual, …, CompareNever }
enum ComparisonMode { CompareRefToTexture, CompareNone }
enum CoordinateDirection { DirectionS, DirectionT, DirectionR }
enum CubeMapFace { CubeMapPositiveX, CubeMapNegativeX, CubeMapPositiveY, CubeMapNegativeY, CubeMapPositiveZ, CubeMapNegativeZ }
enum DepthStencilMode { DepthMode, StencilMode }
enum Feature { ImmutableStorage, ImmutableMultisampleStorage, TextureRectangle, TextureArrays, Texture3D, …, TextureMipMapLevel }
flags Features
enum Filter { Nearest, Linear, NearestMipMapNearest, NearestMipMapLinear, LinearMipMapNearest, LinearMipMapLinear }
enum MipMapGeneration { GenerateMipMaps, DontGenerateMipMaps }
enum PixelFormat { NoSourceFormat, Red, RG, RGB, BGR, …, LuminanceAlpha }
enum PixelType { NoPixelType, Int8, UInt8, Int16, UInt16, …, Float32_D32_UInt32_S8_X24 }
enum SwizzleComponent { SwizzleRed, SwizzleGreen, SwizzleBlue, SwizzleAlpha }
enum SwizzleValue { RedValue, GreenValue, BlueValue, AlphaValue, ZeroValue, OneValue }
enum Target { Target1D, Target1DArray, Target2D, Target2DArray, Target3D, …, TargetBuffer }
enum TextureFormat { NoFormat, R8_UNorm, RG8_UNorm, RGB8_UNorm, RGBA8_UNorm, …, LuminanceAlphaFormat }
enum TextureUnitReset { ResetTextureUnit, DontResetTextureUnit }
enum WrapMode { Repeat, MirroredRepeat, ClampToEdge, ClampToBorder }

公共函数

QOpenGLTexture(QOpenGLTexture::Target target)
QOpenGLTexture(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = GenerateMipMaps)
void allocateStorage()
void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
void bind()
void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = DontResetTextureUnit)
QColor borderColor() const
void borderColor(float *border) const
void borderColor(int *border) const
void borderColor(unsigned int *border) const
QOpenGLTexture::ComparisonFunction comparisonFunction() const
QOpenGLTexture::ComparisonMode comparisonMode() const
bool create()
QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const
int depth() const
QOpenGLTexture::DepthStencilMode depthStencilMode() const
void destroy()
int faces() const
QOpenGLTexture::TextureFormat format() const
void generateMipMaps()
void generateMipMaps(int baseLevel, bool resetBaseLevel = true)
int height() const
bool isAutoMipMapGenerationEnabled() const
bool isBound() const
bool isBound(uint unit)
bool isCreated() const
bool isFixedSamplePositions() const
bool isStorageAllocated() const
bool isTextureView() const
int layers() const
std::pair<float, float> levelOfDetailRange() const
float levelofDetailBias() const
QOpenGLTexture::Filter magnificationFilter() const
float maximumAnisotropy() const
float maximumLevelOfDetail() const
int maximumMipLevels() const
std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> minMagFilters() const
QOpenGLTexture::Filter minificationFilter() const
float minimumLevelOfDetail() const
int mipBaseLevel() const
std::pair<int, int> mipLevelRange() const
int mipLevels() const
int mipMaxLevel() const
void release()
void release(uint unit, QOpenGLTexture::TextureUnitReset reset = DontResetTextureUnit)
int samples() const
void setAutoMipMapGenerationEnabled(bool enabled)
void setBorderColor(const QColor &color)
void setBorderColor(float r, float g, float b, float a)
void setBorderColor(int r, int g, int b, int a)
void setBorderColor(uint r, uint g, uint b, uint a)
void setComparisonFunction(QOpenGLTexture::ComparisonFunction function)
void setComparisonMode(QOpenGLTexture::ComparisonMode mode)
void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setCompressedData(int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setCompressedData(int mipLevel, 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)
void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = GenerateMipMaps)
void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::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, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::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, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::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, QOpenGLTexture::CubeMapFace face, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::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, QOpenGLTexture::CubeMapFace face, int layerCount, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)
void setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
void setFixedSamplePositions(bool fixed)
void setFormat(QOpenGLTexture::TextureFormat format)
void setLayers(int layers)
void setLevelOfDetailRange(float min, float max)
void setLevelofDetailBias(float bias)
void setMagnificationFilter(QOpenGLTexture::Filter filter)
void setMaximumAnisotropy(float anisotropy)
void setMaximumLevelOfDetail(float value)
void setMinMagFilters(QOpenGLTexture::Filter minificationFilter, QOpenGLTexture::Filter magnificationFilter)
void setMinificationFilter(QOpenGLTexture::Filter filter)
void setMinimumLevelOfDetail(float value)
void setMipBaseLevel(int baseLevel)
void setMipLevelRange(int baseLevel, int maxLevel)
void setMipLevels(int levels)
void setMipMaxLevel(int maxLevel)
void setSamples(int samples)
void setSize(int width, int height = 1, int depth = 1)
void setSwizzleMask(QOpenGLTexture::SwizzleComponent component, QOpenGLTexture::SwizzleValue value)
void setSwizzleMask(QOpenGLTexture::SwizzleValue r, QOpenGLTexture::SwizzleValue g, QOpenGLTexture::SwizzleValue b, QOpenGLTexture::SwizzleValue a)
void setWrapMode(QOpenGLTexture::WrapMode mode)
void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode)
QOpenGLTexture::SwizzleValue swizzleMask(QOpenGLTexture::SwizzleComponent component) const
QOpenGLTexture::Target target() const
GLuint textureId() const
int width() const
QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const

静态公共成员

GLuint boundTextureId(QOpenGLTexture::BindingTarget target)
GLuint boundTextureId(uint unit, QOpenGLTexture::BindingTarget target)
bool hasFeature(QOpenGLTexture::Feature feature)

详细说明

QOpenGLTexture 使您能够轻松处理 OpenGL 纹理,以及根据您的 OpenGL 实现能力所提供的各种功能和目标。

QOpenGLTexture 的典型使用模式如下

  • 通过指定纹理目标类型来实例化对象
  • 设置影响存储要求的属性,例如存储格式、尺寸
  • 分配服务器端存储空间
  • 可选:上传像素数据
  • 可选地设置其他属性,例如过滤和边界选项
  • 使用纹理进行渲染或渲染到纹理

在通常情况下,如果仅将QImage 作为纹理像素数据的来源,上述大部分步骤都会自动完成。

// Prepare texture
QOpenGLTexture *texture = new QOpenGLTexture(QImage(fileName).flipped());
texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
texture->setMagnificationFilter(QOpenGLTexture::Linear);
...
// Render with texture
texture->bind();
glDrawArrays(...);

请注意,QImage 已进行垂直翻转,以适应 OpenGL 和QImage 中 y 轴方向相反的情况。另一种方法是对纹理坐标进行变换。

警告: QOpenGLTexture 所使用的所有 数据均 应为可信内容。像素和图像数据会被传递给底层的 OpenGL 实现。建议应用程序开发人员在将用户提供的内容传递给setData() 等函数之前,仔细考虑潜在的影响。

成员类型文档

enum QOpenGLTexture::BindingTarget

此枚举定义了纹理单元的可能绑定目标。

常量值描述
QOpenGLTexture::BindingTarget1D0x8068等同于 GL_TEXTURE_BINDING_1D
QOpenGLTexture::BindingTarget1DArray0x8C1C等同于 GL_TEXTURE_BINDING_1D_ARRAY
QOpenGLTexture::BindingTarget2D0x8069等同于 GL_TEXTURE_BINDING_2D
QOpenGLTexture::BindingTarget2DArray0x8C1D等同于 GL_TEXTURE_BINDING_2D_ARRAY
QOpenGLTexture::BindingTarget3D0x806A等同于 GL_TEXTURE_BINDING_3D
QOpenGLTexture::BindingTargetCubeMap0x8514等同于 GL_TEXTURE_BINDING_CUBE_MAP
QOpenGLTexture::BindingTargetCubeMapArray0x900A等同于 GL_TEXTURE_BINDING_CUBE_MAP_ARRAY
QOpenGLTexture::BindingTarget2DMultisample0x9104等同于 GL_TEXTURE_BINDING_2D_MULTISAMPLE
QOpenGLTexture::BindingTarget2DMultisampleArray0x9105等同于 GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
QOpenGLTexture::BindingTargetRectangle0x84F6等同于 GL_TEXTURE_BINDING_RECTANGLE
QOpenGLTexture::BindingTargetBuffer0x8C2C等同于 GL_TEXTURE_BINDING_BUFFER

enum QOpenGLTexture::ComparisonFunction

此枚举用于指定当此纹理启用纹理比较时,应使用哪种比较运算符。

常量值描述
QOpenGLTexture::CompareLessEqual0x0203等同于 GL_LEQUAL。
QOpenGLTexture::CompareGreaterEqual0x0206等同于 GL_GEQUAL。
QOpenGLTexture::CompareLess0x0201等同于 GL_LESS。
QOpenGLTexture::CompareGreater0x0204等同于 GL_GREATER。
QOpenGLTexture::CompareEqual0x0202等同于 GL_EQUAL。
QOpenGLTexture::CompareNotEqual0x0205等同于 GL_NOTEQUAL。
QOpenGLTexture::CompareAlways0x0207等同于 GL_ALWAYS。
QOpenGLTexture::CompareNever0x0200等同于 GL_NEVER。

enum QOpenGLTexture::ComparisonMode

此枚举指定在采样此纹理时使用的比较模式。

常量值描述
QOpenGLTexture::CompareRefToTexture0x884E等同于 GL_COMPARE_REF_TO_TEXTURE。
QOpenGLTexture::CompareNone0x0000等同于 GL_NONE。

enum QOpenGLTexture::CoordinateDirection

此枚举定义了可能的纹理坐标方向

常量值描述
QOpenGLTexture::DirectionS0x2802水平方向。等同于 GL_TEXTURE_WRAP_S
QOpenGLTexture::DirectionT0x2803垂直方向。等同于 GL_TEXTURE_WRAP_T
QOpenGLTexture::DirectionR0x8072深度方向。等同于 GL_TEXTURE_WRAP_R

enum QOpenGLTexture::CubeMapFace

此枚举定义了 CubeMap 的可能面。

常量值描述
QOpenGLTexture::CubeMapPositiveX0x8515等同于 GL_TEXTURE_CUBE_MAP_POSITIVE_X
QOpenGLTexture::CubeMapNegativeX0x8516等同于 GL_TEXTURE_CUBE_MAP_NEGATIVE_X
QOpenGLTexture::CubeMapPositiveY0x8517等同于 GL_TEXTURE_CUBE_MAP_POSITIVE_Y
QOpenGLTexture::CubeMapNegativeY0x8518等同于 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
QOpenGLTexture::CubeMapPositiveZ0x8519等同于 GL_TEXTURE_CUBE_MAP_POSITIVE_Z
QOpenGLTexture::CubeMapNegativeZ0x851A等同于 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z

enum QOpenGLTexture::DepthStencilMode

此枚举指定在采样纹理时访问深度/模板纹理的哪个组件。

常量值描述
QOpenGLTexture::DepthMode0x1902等同于 GL_DEPTH_COMPONENT。
QOpenGLTexture::StencilMode0x1901等同于 GL_STENCIL_INDEX。

enum QOpenGLTexture::Feature
flags QOpenGLTexture::Features

此枚举定义了可进行测试的 OpenGL 纹理相关功能。

常量值描述
QOpenGLTexture::ImmutableStorage0x00000001对不可变纹理存储的支持
QOpenGLTexture::ImmutableMultisampleStorage0x00000002支持具有多采样目标的不可变纹理存储
QOpenGLTexture::TextureRectangle0x00000004支持 GL_TEXTURE_RECTANGLE 目标
QOpenGLTexture::TextureArrays0x00000008支持具有数组层的纹理目标
QOpenGLTexture::Texture3D0x00000010支持三维纹理目标
QOpenGLTexture::TextureMultisample0x00000020支持具有多采样能力的纹理目标
QOpenGLTexture::TextureBuffer0x00000040支持将 OpenGL 缓冲区对象用作数据源的纹理
QOpenGLTexture::TextureCubeMapArrays0x00000080支持立方贴图数组纹理目标
QOpenGLTexture::Swizzle0x00000100支持纹理分量交换掩码
QOpenGLTexture::StencilTexturing0x00000200支持模板纹理(即在 GLSL 着色器中查询组合深度/模板格式纹理的深度或模板分量)。
QOpenGLTexture::AnisotropicFiltering0x00000400支持各向异性纹理过滤
QOpenGLTexture::NPOTTextures0x00000800对非二的幂纹理的基本支持
QOpenGLTexture::NPOTTextureRepeat0x00001000全面支持非2的幂纹理,包括纹理重复模式
QOpenGLTexture::Texture1D0x00002000支持一维纹理目标
QOpenGLTexture::TextureComparisonOperators0x00004000支持纹理比较运算符
QOpenGLTexture::TextureMipMapLevel0x00008000支持设置基础和最大 Mipmap 级别

“Features”类型是QFlags<Feature> 的 typedef 定义。它存储了 Feature 值的按“或”运算组合。

enum QOpenGLTexture::Filter

此枚举定义了QOpenGLTexture 对象的过滤参数。

常量值描述
QOpenGLTexture::Nearest0x2600等同于 GL_NEAREST
QOpenGLTexture::Linear0x2601等同于 GL_LINEAR
QOpenGLTexture::NearestMipMapNearest0x2700等同于 GL_NEAREST_MIPMAP_NEAREST
QOpenGLTexture::NearestMipMapLinear0x2702等同于 GL_NEAREST_MIPMAP_LINEAR
QOpenGLTexture::LinearMipMapNearest0x2701等同于 GL_LINEAR_MIPMAP_NEAREST
QOpenGLTexture::LinearMipMapLinear0x2703等同于 GL_LINEAR_MIPMAP_LINEAR

enum QOpenGLTexture::MipMapGeneration

此枚举定义了用于控制Mipmap生成的选项。

常量值描述
QOpenGLTexture::GenerateMipMaps0应生成 Mipmap
QOpenGLTexture::DontGenerateMipMaps1不应生成Mipmap

enum QOpenGLTexture::PixelFormat

此枚举定义了像素传输操作中客户端可能支持的像素格式。

常量值描述
QOpenGLTexture::NoSourceFormat0等同于 GL_NONE
QOpenGLTexture::Red0x1903等同于 GL_RED
QOpenGLTexture::RG0x8227等同于 GL_RG
QOpenGLTexture::RGB0x1907等同于 GL_RGB
QOpenGLTexture::BGR0x80E0等同于 GL_BGR
QOpenGLTexture::RGBA0x1908等同于 GL_RGBA
QOpenGLTexture::BGRA0x80E1等同于 GL_BGRA
QOpenGLTexture::Red_Integer0x8D94等同于 GL_RED_INTEGER
QOpenGLTexture::RG_Integer0x8228等同于 GL_RG_INTEGER
QOpenGLTexture::RGB_Integer0x8D98等同于 GL_RGB_INTEGER
QOpenGLTexture::BGR_Integer0x8D9A等同于 GL_BGR_INTEGER
QOpenGLTexture::RGBA_Integer0x8D99等同于 GL_RGBA_INTEGER
QOpenGLTexture::BGRA_Integer0x8D9B等同于 GL_BGRA_INTEGER
QOpenGLTexture::Stencil0x1901等同于 GL_STENCIL_INDEX。自 Qt 5.4 起引入
QOpenGLTexture::Depth0x1902等同于 GL_DEPTH_COMPONENT
QOpenGLTexture::DepthStencil0x84F9等同于 GL_DEPTH_STENCIL
QOpenGLTexture::Alpha0x1906等同于 GL_ALPHA(仅限 OpenGL ES 2)
QOpenGLTexture::Luminance0x1909等同于 GL_LUMINANCE(仅限 OpenGL ES 2)
QOpenGLTexture::LuminanceAlpha0x190A等同于 GL_LUMINANCE_ALPHA(仅限 OpenGL ES 2)

enum QOpenGLTexture::PixelType

此枚举定义了像素传输操作中可能的像素数据类型

常量值描述
QOpenGLTexture::NoPixelType0等同于 GL_NONE
QOpenGLTexture::Int80x1400等同于 GL_BYTE
QOpenGLTexture::UInt80x1401等同于 GL_UNSIGNED_BYTE
QOpenGLTexture::Int160x1402等同于 GL_SHORT
QOpenGLTexture::UInt160x1403等同于 GL_UNSIGNED_SHORT
QOpenGLTexture::Int320x1404等同于 GL_INT
QOpenGLTexture::UInt320x1405等同于 GL_UNSIGNED_INT
QOpenGLTexture::Float160x140B等同于 GL_HALF_FLOAT
QOpenGLTexture::Float16OES0x8D61等同于 GL_HALF_FLOAT_OES
QOpenGLTexture::Float320x1406等同于 GL_FLOAT
QOpenGLTexture::UInt32_RGB9_E50x8C3E等同于 GL_UNSIGNED_INT_5_9_9_9_REV
QOpenGLTexture::UInt32_RG11B10F0x8C3B等同于 GL_UNSIGNED_INT_10F_11F_11F_REV
QOpenGLTexture::UInt8_RG3B20x8032等同于 GL_UNSIGNED_BYTE_3_3_2
QOpenGLTexture::UInt8_RG3B2_Rev0x8362等同于 GL_UNSIGNED_BYTE_2_3_3_REV
QOpenGLTexture::UInt16_RGB5A10x8034等同于 GL_UNSIGNED_SHORT_5_5_5_1
QOpenGLTexture::UInt16_RGB5A1_Rev0x8366等同于 GL_UNSIGNED_SHORT_1_5_5_5_REV
QOpenGLTexture::UInt16_R5G6B50x8363等同于 GL_UNSIGNED_SHORT_5_6_5
QOpenGLTexture::UInt16_R5G6B5_Rev0x8364等同于 GL_UNSIGNED_SHORT_5_6_5_REV
QOpenGLTexture::UInt16_RGBA40x8033等同于 GL_UNSIGNED_SHORT_4_4_4_4
QOpenGLTexture::UInt16_RGBA4_Rev0x8365等同于 GL_UNSIGNED_SHORT_4_4_4_4_REV
QOpenGLTexture::UInt32_RGBA80x8035等同于 GL_UNSIGNED_INT_8_8_8_8
QOpenGLTexture::UInt32_RGBA8_Rev0x8367等同于 GL_UNSIGNED_INT_8_8_8_8_REV
QOpenGLTexture::UInt32_RGB10A20x8036等同于 GL_UNSIGNED_INT_10_10_10_2
QOpenGLTexture::UInt32_RGB10A2_Rev0x8368等同于 GL_UNSIGNED_INT_2_10_10_10_REV
QOpenGLTexture::UInt32_D24S80x84FA等同于 GL_UNSIGNED_INT_24_8。在 Qt 5.4 中引入
QOpenGLTexture::Float32_D32_UInt32_S8_X240x8DAD等同于 GL_FLOAT_32_UNSIGNED_INT_24_8_REV。自 Qt 5.4 起引入

enum QOpenGLTexture::SwizzleComponent

此枚举定义了可分配混淆掩码的纹理颜色分量。

常量值描述
QOpenGLTexture::SwizzleRed0x8E42红色分量。等同于 GL_TEXTURE_SWIZZLE_R
QOpenGLTexture::SwizzleGreen0x8E43绿色分量。等同于 GL_TEXTURE_SWIZZLE_G
QOpenGLTexture::SwizzleBlue0x8E44蓝色分量。等同于 GL_TEXTURE_SWIZZLE_B
QOpenGLTexture::SwizzleAlpha0x8E45Alpha分量。等同于 GL_TEXTURE_SWIZZLE_A

enum QOpenGLTexture::SwizzleValue

此枚举定义了纹理交换的可能掩码值。

常量值描述
QOpenGLTexture::RedValue0x1903将该分量映射到红色通道。等同于 GL_RED
QOpenGLTexture::GreenValue0x1904将该分量映射到绿色通道。等同于 GL_GREEN
QOpenGLTexture::BlueValue0x1905将该分量映射到蓝色通道。等同于 GL_BLUE
QOpenGLTexture::AlphaValue0x1906将该分量映射到透明度通道。等同于 GL_ALPHA
QOpenGLTexture::ZeroValue0将该分量映射到固定值 0。等同于 GL_ZERO
QOpenGLTexture::OneValue1将该分量映射到固定值 1。等同于 GL_ONE

enum QOpenGLTexture::Target

此枚举定义了QOpenGLTexture 对象的纹理目标。有关创建数组纹理的更多信息,请参阅“数组纹理”。

常量值描述
QOpenGLTexture::Target1D0x0DE0一维纹理。等同于 GL_TEXTURE_1D。
QOpenGLTexture::Target1DArray0x8C18一维纹理的数组。等同于 GL_TEXTURE_1D_ARRAY
QOpenGLTexture::Target2D0x0DE1一个二维纹理。等同于 GL_TEXTURE_2D
QOpenGLTexture::Target2DArray0x8C1A二维纹理数组。等同于 GL_TEXTURE_2D_ARRAY
QOpenGLTexture::Target3D0x806F一个三维纹理。等同于 GL_TEXTURE_3D
QOpenGLTexture::TargetCubeMap0x8513立方贴图。等同于 GL_TEXTURE_CUBE_MAP
QOpenGLTexture::TargetCubeMapArray0x9009立方贴图纹理数组。等同于 GL_TEXTURE_CUBE_MAP_ARRAY
QOpenGLTexture::Target2DMultisample0x9100支持多采样的二维纹理。等同于 GL_TEXTURE_2D_MULTISAMPLE
QOpenGLTexture::Target2DMultisampleArray0x9102支持多采样的二维纹理数组。等同于 GL_TEXTURE_2D_MULTISAMPLE_ARRAY
QOpenGLTexture::TargetRectangle0x84F5矩形二维纹理。等同于 GL_TEXTURE_RECTANGLE
QOpenGLTexture::TargetBuffer0x8C2A数据来自 OpenGL 缓冲区对象的纹理。等同于 GL_TEXTURE_BUFFER

enum QOpenGLTexture::TextureFormat

此枚举定义了可能的纹理格式。根据您的 OpenGL 实现情况,可能仅支持其中的一部分。

常量值描述
QOpenGLTexture::NoFormat0等同于 GL_NONE
QOpenGLTexture::R8_UNorm0x8229等同于 GL_R8
QOpenGLTexture::RG8_UNorm0x822B等同于 GL_RG8
QOpenGLTexture::RGB8_UNorm0x8051等同于 GL_RGB8
QOpenGLTexture::RGBA8_UNorm0x8058等同于 GL_RGBA8
QOpenGLTexture::R16_UNorm0x822A等同于 GL_R16
QOpenGLTexture::RG16_UNorm0x822C等同于 GL_RG16
QOpenGLTexture::RGB16_UNorm0x8054等同于 GL_RGB16
QOpenGLTexture::RGBA16_UNorm0x805B等同于 GL_RGBA16
QOpenGLTexture::R8_SNorm0x8F94等同于 GL_R8_SNORM
QOpenGLTexture::RG8_SNorm0x8F95等同于 GL_RG8_SNORM
QOpenGLTexture::RGB8_SNorm0x8F96等同于 GL_RGB8_SNORM
QOpenGLTexture::RGBA8_SNorm0x8F97等同于 GL_RGBA8_SNORM
QOpenGLTexture::R16_SNorm0x8F98等同于 GL_R16_SNORM
QOpenGLTexture::RG16_SNorm0x8F99等同于 GL_RG16_SNORM
QOpenGLTexture::RGB16_SNorm0x8F9A等同于 GL_RGB16_SNORM
QOpenGLTexture::RGBA16_SNorm0x8F9B等同于 GL_RGBA16_SNORM
QOpenGLTexture::R8U0x8232等同于 GL_R8UI
QOpenGLTexture::RG8U0x8238等同于 GL_RG8UI
QOpenGLTexture::RGB8U0x8D7D等同于 GL_RGB8UI
QOpenGLTexture::RGBA8U0x8D7C等同于 GL_RGBA8UI
QOpenGLTexture::R16U0x8234等同于 GL_R16UI
QOpenGLTexture::RG16U0x823A等同于 GL_RG16UI
QOpenGLTexture::RGB16U0x8D77等同于 GL_RGB16UI
QOpenGLTexture::RGBA16U0x8D76等同于 GL_RGBA16UI
QOpenGLTexture::R32U0x8236等同于 GL_R32UI
QOpenGLTexture::RG32U0x823C等同于 GL_RG32UI
QOpenGLTexture::RGB32U0x8D71等同于 GL_RGB32UI
QOpenGLTexture::RGBA32U0x8D70等同于 GL_RGBA32UI
QOpenGLTexture::R8I0x8231等同于 GL_R8I
QOpenGLTexture::RG8I0x8237等同于 GL_RG8I
QOpenGLTexture::RGB8I0x8D8F等同于 GL_RGB8I
QOpenGLTexture::RGBA8I0x8D8E等同于 GL_RGBA8I
QOpenGLTexture::R16I0x8233等同于 GL_R16I
QOpenGLTexture::RG16I0x8239等同于 GL_RG16I
QOpenGLTexture::RGB16I0x8D89等同于 GL_RGB16I
QOpenGLTexture::RGBA16I0x8D88等同于 GL_RGBA16I
QOpenGLTexture::R32I0x8235等同于 GL_R32I
QOpenGLTexture::RG32I0x823B等同于 GL_RG32I
QOpenGLTexture::RGB32I0x8D83等同于 GL_RGB32I
QOpenGLTexture::RGBA32I0x8D82等同于 GL_RGBA32I
QOpenGLTexture::R16F0x822D等同于 GL_R16F
QOpenGLTexture::RG16F0x822F等同于 GL_RG16F
QOpenGLTexture::RGB16F0x881B等同于 GL_RGB16F
QOpenGLTexture::RGBA16F0x881A等同于 GL_RGBA16F
QOpenGLTexture::R32F0x822E等同于 GL_R32F
QOpenGLTexture::RG32F0x8230等同于 GL_RG32F
QOpenGLTexture::RGB32F0x8815等同于 GL_RGB32F
QOpenGLTexture::RGBA32F0x8814等同于 GL_RGBA32F
QOpenGLTexture::RGB9E50x8C3D等同于 GL_RGB9_E5
QOpenGLTexture::RG11B10F0x8C3A等同于 GL_R11F_G11F_B10F
QOpenGLTexture::RG3B20x2A10等同于 GL_R3_G3_B2
QOpenGLTexture::R5G6B50x8D62等同于 GL_RGB565
QOpenGLTexture::RGB5A10x8057等同于 GL_RGB5_A1
QOpenGLTexture::RGBA40x8056等同于 GL_RGBA4
QOpenGLTexture::RGB10A20x906F等同于 GL_RGB10_A2UI
QOpenGLTexture::D160x81A5等同于 GL_DEPTH_COMPONENT16
QOpenGLTexture::D240x81A6等同于 GL_DEPTH_COMPONENT24
QOpenGLTexture::D24S80x88F0等同于 GL_DEPTH24_STENCIL8
QOpenGLTexture::D320x81A7等同于 GL_DEPTH_COMPONENT32
QOpenGLTexture::D32F0x8CAC等同于 GL_DEPTH_COMPONENT32F
QOpenGLTexture::D32FS8X240x8CAD等同于 GL_DEPTH32F_STENCIL8
QOpenGLTexture::S80x8D48等同于 GL_STENCIL_INDEX8。自 Qt 5.4 起引入
QOpenGLTexture::RGB_DXT10x83F0等同于 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
QOpenGLTexture::RGBA_DXT10x83F1等同于 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
QOpenGLTexture::RGBA_DXT30x83F2等同于 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
QOpenGLTexture::RGBA_DXT50x83F3等同于 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
QOpenGLTexture::R_ATI1N_UNorm0x8DBB等同于 GL_COMPRESSED_RED_RGTC1
QOpenGLTexture::R_ATI1N_SNorm0x8DBC等同于 GL_COMPRESSED_SIGNED_RED_RGTC1
QOpenGLTexture::RG_ATI2N_UNorm0x8DBD等同于 GL_COMPRESSED_RG_RGTC2
QOpenGLTexture::RG_ATI2N_SNorm0x8DBE等同于 GL_COMPRESSED_SIGNED_RG_RGTC2
QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT0x8E8F等同于 GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
QOpenGLTexture::RGB_BP_SIGNED_FLOAT0x8E8E等同于 GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
QOpenGLTexture::RGB_BP_UNorm0x8E8C等同于 GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
QOpenGLTexture::R11_EAC_UNorm0x9270等同于 GL_COMPRESSED_R11_EAC
QOpenGLTexture::R11_EAC_SNorm0x9271等同于 GL_COMPRESSED_SIGNED_R11_EAC
QOpenGLTexture::RG11_EAC_UNorm0x9272等同于 GL_COMPRESSED_RG11_EAC
QOpenGLTexture::RG11_EAC_SNorm0x9273等同于 GL_COMPRESSED_SIGNED_RG11_EAC
QOpenGLTexture::RGB8_ETC20x9274等同于 GL_COMPRESSED_RGB8_ETC2
QOpenGLTexture::SRGB8_ETC20x9275等同于 GL_COMPRESSED_SRGB8_ETC2
QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC20x9276等同于 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC20x9277等同于 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
QOpenGLTexture::RGBA8_ETC2_EAC0x9278等同于 GL_COMPRESSED_RGBA8_ETC2_EAC
QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC0x9279等同于 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
QOpenGLTexture::RGB8_ETC10x8D64等同于 GL_ETC1_RGB8_OES
QOpenGLTexture::RGBA_ASTC_4x40x93B0等同于 GL_COMPRESSED_RGBA_ASTC_4x4_KHR
QOpenGLTexture::RGBA_ASTC_5x40x93B1等同于 GL_COMPRESSED_RGBA_ASTC_5x4_KHR
QOpenGLTexture::RGBA_ASTC_5x50x93B2等同于 GL_COMPRESSED_RGBA_ASTC_5x5_KHR
QOpenGLTexture::RGBA_ASTC_6x50x93B3等同于 GL_COMPRESSED_RGBA_ASTC_6x5_KHR
QOpenGLTexture::RGBA_ASTC_6x60x93B4等同于 GL_COMPRESSED_RGBA_ASTC_6x6_KHR
QOpenGLTexture::RGBA_ASTC_8x50x93B5等同于 GL_COMPRESSED_RGBA_ASTC_8x5_KHR
QOpenGLTexture::RGBA_ASTC_8x60x93B6等同于 GL_COMPRESSED_RGBA_ASTC_8x6_KHR
QOpenGLTexture::RGBA_ASTC_8x80x93B7等同于 GL_COMPRESSED_RGBA_ASTC_8x8_KHR
QOpenGLTexture::RGBA_ASTC_10x50x93B8等同于 GL_COMPRESSED_RGBA_ASTC_10x5_KHR
QOpenGLTexture::RGBA_ASTC_10x60x93B9等同于 GL_COMPRESSED_RGBA_ASTC_10x6_KHR
QOpenGLTexture::RGBA_ASTC_10x80x93BA等同于 GL_COMPRESSED_RGBA_ASTC_10x8_KHR
QOpenGLTexture::RGBA_ASTC_10x100x93BB等同于 GL_COMPRESSED_RGBA_ASTC_10x10_KHR
QOpenGLTexture::RGBA_ASTC_12x100x93BC等同于 GL_COMPRESSED_RGBA_ASTC_12x10_KHR
QOpenGLTexture::RGBA_ASTC_12x120x93BD等同于 GL_COMPRESSED_RGBA_ASTC_12x12_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_4x40x93D0等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_5x40x93D1等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_5x50x93D2等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_6x50x93D3等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_6x60x93D4等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_8x50x93D5等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_8x60x93D6等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_8x80x93D7等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_10x50x93D8等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_10x60x93D9等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_10x80x93DA等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_10x100x93DB等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_12x100x93DC等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
QOpenGLTexture::SRGB8_Alpha8_ASTC_12x120x93DD等同于 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
QOpenGLTexture::SRGB80x8C41等同于 GL_SRGB8
QOpenGLTexture::SRGB8_Alpha80x8C43等同于 GL_SRGB8_ALPHA8
QOpenGLTexture::SRGB_DXT10x8C4C等同于 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
QOpenGLTexture::SRGB_Alpha_DXT10x8C4D等同于 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
QOpenGLTexture::SRGB_Alpha_DXT30x8C4E等同于 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
QOpenGLTexture::SRGB_Alpha_DXT50x8C4F等同于 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
QOpenGLTexture::SRGB_BP_UNorm0x8E8D等同于 GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
QOpenGLTexture::DepthFormat0x1902等同于 GL_DEPTH_COMPONENT(仅限 OpenGL ES 3 或带 OES_depth_texture 的 ES 2)
QOpenGLTexture::AlphaFormat0x1906等同于 GL_ALPHA(仅限 OpenGL ES 2)
QOpenGLTexture::RGBFormat0x1907等同于 GL_RGB(仅限 OpenGL ES 2)
QOpenGLTexture::RGBAFormat0x1908等同于 GL_RGBA(仅限 OpenGL ES 2)
QOpenGLTexture::LuminanceFormat0x1909等同于 GL_LUMINANCE(仅限 OpenGL ES 2)
QOpenGLTexture::LuminanceAlphaFormat0x190A等同于 GL_LUMINANCE_ALPHA(仅限 OpenGL ES 2)

enum QOpenGLTexture::TextureUnitReset

此枚举定义了用于控制纹理单元激活的选项。

常量值描述
QOpenGLTexture::ResetTextureUnit0将重置上一个活动的纹理单元
QOpenGLTexture::DontResetTextureUnit1先前处于活动状态的纹理单元不会被重置

enum QOpenGLTexture::WrapMode

此枚举定义了可能的纹理坐标环绕模式。

常量值描述
QOpenGLTexture::Repeat0x2901纹理坐标会重复。等同于 GL_REPEAT
QOpenGLTexture::MirroredRepeat0x8370纹理坐标以 0 和 1 为轴进行镜像重复。等同于 GL_MIRRORED_REPEAT
QOpenGLTexture::ClampToEdge0x812F将纹理坐标限制在 [0,1] 范围内。等同于 GL_CLAMP_TO_EDGE
QOpenGLTexture::ClampToBorder0x812D与 ClampToEdge 类似,但还会使用固定的边框颜色对 0 和 1 处的采样点进行混合。等同于 GL_CLAMP_TO_BORDER

成员函数文档

[explicit] QOpenGLTexture::QOpenGLTexture(QOpenGLTexture::Target target)

创建一个 QOpenGLTexture 对象,该对象随后可绑定到target 。

这不会创建底层的 OpenGL 纹理对象。因此,使用此构造函数进行初始化时,无需有效的当前 OpenGL 上下文。

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

创建一个 QOpenGLTexture 对象,该对象稍后可绑定到 2D 纹理目标,并包含image 中的像素数据。如果希望生成一组 Mipmap,请将genMipMaps 设置为true (这是默认值)。

这确实会创建底层的 OpenGL 纹理对象。因此,使用此构造函数进行初始化需要一个有效的当前 OpenGL 上下文。

注意: image 会自动转换为QImage::Format_RGBA8888 ,对于格式不同的大尺寸图像,这可能会影响性能。

void QOpenGLTexture::allocateStorage()

为该纹理对象分配服务器端存储空间,同时考虑其格式、尺寸、Mipmap 级别、数组层和立方体贴图面。

一旦存储空间被分配,就无法再更改这些属性。

如果支持,QOpenGLTexture 将使用不可变纹理存储。

为纹理分配存储空间后,即可通过setData() 的其中一个重载函数上传像素数据。

注意:如果 不可变纹理存储不可用,则将使用默认的像素格式和像素类型来创建可变存储。您可以使用其他 `allocateStorage()` 重载方法来精确指定分配可变存储时要使用的像素格式和像素类型; 这在某些 OpenGL ES 实现(尤其是 OpenGL ES 2)中特别有用,因为在这些实现中,分配时使用的像素格式和像素类型必须与后续任何setData() 调用中传递的格式和类型完全匹配。

另请参阅 isStorageAllocated() 和setData()。

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

为该纹理对象分配服务器端存储空间,同时考虑其格式、尺寸、Mipmap 级别、数组层和立方体贴图面。

一旦存储空间被分配,就无法再更改这些属性。

如果支持,QOpenGLTexture 将使用不可变纹理存储。但是,如果不可变纹理存储不可用,则将使用指定的pixelFormat 和pixelType 来分配可变存储;请注意,在某些 OpenGL 实现中(尤其是 OpenGL ES 2),它们必须与传递给任何后续setData() 调用的格式和类型完全匹配。

一旦为纹理分配了存储空间,即可通过其中一个setData()的重载函数上传像素数据。

另请参阅 isStorageAllocated() 和setData()。

void QOpenGLTexture::bind()

将此纹理绑定到当前活动的纹理单元,以便进行渲染。请注意,您无需绑定QOpenGLTexture 对象即可对其进行修改,因为该实现会在支持的情况下使用EXT_direct_state_access扩展,而在不支持时则会模拟该扩展。

另请参阅 release()。

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

将此纹理绑定到纹理单元unit ,以便进行渲染。请注意,您无需绑定QOpenGLTexture 对象即可对其进行修改,因为该实现会在可用时使用 EXT_direct_state_access 扩展,而在不可用时则对其进行模拟。

如果参数reset 为true ,则该函数将把当前活动单元恢复为函数调用时的活动纹理单元。

另请参阅 release()。

QColor QOpenGLTexture::borderColor() const

返回此纹理的边框颜色。

另请参阅 ` setBorderColor()`。

void QOpenGLTexture::borderColor(float *border) const

将纹理边框颜色写入由 `border` 指向的数组的前四个元素中。

另请参阅 setBorderColor()。

void QOpenGLTexture::borderColor(int *border) const

将纹理边框颜色写入由border 指针所指向的数组的前四个元素中。

这是一个重载函数。

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

将纹理边框颜色写入由border 所指向的数组的前四个元素中。

这是一个重载函数。

[static] GLuint QOpenGLTexture::boundTextureId(QOpenGLTexture::BindingTarget target)

返回绑定到当前活动纹理单元target 上的纹理的textureId 。

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

返回绑定到纹理单元unit 的target 上的纹理的textureId 。

QOpenGLTexture::ComparisonFunction QOpenGLTexture::comparisonFunction() const

返回为该纹理设置的纹理比较运算符。默认情况下,纹理使用CompareLessEqual 比较函数。

另请参阅 setComparisonFunction()。

QOpenGLTexture::ComparisonMode QOpenGLTexture::comparisonMode() const

返回此纹理上设置的纹理比较模式。默认情况下,纹理的比较模式为CompareNone (即禁用比较)。

另请参阅 setComparisonMode()。

bool QOpenGLTexture::create()

创建底层的 OpenGL 纹理对象。这需要一个当前有效的 OpenGL 上下文。如果纹理对象已经存在,则该函数不执行任何操作。

纹理对象创建完成后,可通过textureId()函数获取对象名称。若需针对该纹理进行一些原始的OpenGL调用,此功能可能会派上用场。

通常情况下无需直接调用此函数,因为所有用于设置纹理对象属性的函数都会隐式地为您调用 create()。

若创建成功,则返回true ;否则返回false 。

另请参阅 destroy()、isCreated() 和textureId()。

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

尝试在此纹理上创建一个纹理视图。纹理视图与 SQL 中的视图有些类似,它呈现的是原始数据的受限或重新解释的视图。纹理视图不会在服务器端分配额外的存储空间,而是依赖源纹理的存储缓冲区。

纹理视图仅在使用不可变存储时可用。有关纹理视图的更多信息,请参阅 http://www.opengl.org/wiki/Texture_Storage#Texture_views。

target 参数指定了视图所使用的目标。根据原始纹理的目标类型,仅可使用部分目标。例如,针对Target1DArray 纹理的视图可以指定Target1DArray 或Target1D ,但对于后者,通过minimumLayer 和maximumLayer 指定的数组层数必须恰好为1。

对于viewFormat ,同样适用上述约束条件。更多详情请参阅上述链接及规范文档。

参数minimumMipmapLevel 、maximumMipmapLevel 、minimumLayer 和maximumLayer 用于限制纹理视图可访问的纹理部分。

如果纹理视图的创建失败,该函数将返回 0。如果函数成功,它将返回一个指向新QOpenGLTexture 对象的指针,该对象的isTextureView() 函数将返回true 。

另请参阅 isTextureView()。

int QOpenGLTexture::depth() const

返回 3D 纹理的深度。

另请参阅 width()、height() 和setSize()。

QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const

返回使用组合深度/模板格式的纹理的深度模板模式。

另请参阅 setDepthStencilMode()。

void QOpenGLTexture::destroy()

销毁底层的 OpenGL 纹理对象。此操作需要当前存在有效的 OpenGL 上下文。

另请参阅 create()、isCreated() 和textureId()。

int QOpenGLTexture::faces() const

返回此纹理的面数。对于立方贴图和立方贴图数组类型的目标,该值将为 6。

对于非立方贴图类型的目标,该函数将返回 1。

QOpenGLTexture::TextureFormat QOpenGLTexture::format() const

返回此纹理对象的格式。

另请参阅 setFormat()。

void QOpenGLTexture::generateMipMaps()

根据Mipmap级别0为该纹理对象生成Mipmap。如果您使用的纹理目标和过滤选项需要Mipmap,且已禁用自动生成Mipmap的功能,则需要调用此函数或其重载来创建Mipmap链。

注意: OpenGL ES 不支持对压缩纹理生成Mipmap 。

另请参阅 setAutoMipMapGenerationEnabled()、setMipLevels() 和mipLevels()。

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

根据米普贴图级别baseLevel 为该纹理对象生成米普贴图。如果您使用的纹理目标和过滤选项需要米普贴图,但已禁用自动生成米普贴图功能,则需要调用此函数或其重载来创建米普贴图链。

要生成高于baseLevel 的微图,需将微图基级设置为baseLevel ,然后生成微图链。如果resetBaseLevel 的值为true ,则纹理的baseLevel将被重置为其之前的值。

另请参阅 setAutoMipMapGenerationEnabled()、setMipLevels() 和mipLevels()。

[static] bool QOpenGLTexture::hasFeature(QOpenGLTexture::Feature feature)

如果您的 OpenGL 实现和版本支持纹理特性feature ,则返回true 。

int QOpenGLTexture::height() const

返回 2D 或 3D 纹理的高度。

另请参阅 width()、depth() 和setSize()。

bool QOpenGLTexture::isAutoMipMapGenerationEnabled() const

返回此纹理对象是否启用了自动MIP映射生成。

另请参阅 setAutoMipMapGenerationEnabled() 和generateMipMaps()。

bool QOpenGLTexture::isBound() const

如果该纹理已绑定到当前活动纹理单元的相应目标,则返回true 。

另请参阅 bind() 和release()。

bool QOpenGLTexture::isBound(uint unit)

如果该纹理已绑定到纹理单元unit 的对应目标,则返回true 。

另请参阅 bind() 和release()。

bool QOpenGLTexture::isCreated() const

如果底层的 OpenGL 纹理对象已创建,则返回true 。

另请参阅 create()、destroy() 和textureId()。

bool QOpenGLTexture::isFixedSamplePositions() const

返回此纹理是否使用固定模式的多重采样。如果尚未为此纹理分配存储空间,则该函数将返回所请求的固定采样位置设置。

对于不支持多采样的纹理目标,此函数将返回true 。

另请参阅 setFixedSamplePositions() 和isStorageAllocated()。

bool QOpenGLTexture::isStorageAllocated() const

如果已为该纹理分配了服务器端存储空间,则返回true 。

一旦存储空间被分配,纹理格式、尺寸、Mipmap 级别和数组层均无法更改。

另请参阅 allocateStorage()、setSize()、setMipLevels()、setLayers() 以及setFormat()。

bool QOpenGLTexture::isTextureView() const

如果该纹理对象实际上是另一个纹理对象的视图,则返回true 。

另请参阅 createTextureView()。

int QOpenGLTexture::layers() const

返回此纹理的数组层数量。如果尚未为此纹理分配存储空间,则该函数将返回请求的数组层数量。

对于不支持数组层的纹理目标,该函数将返回 1。

另请参阅 setLayers() 和isStorageAllocated()。

std::pair<float, float> QOpenGLTexture::levelOfDetailRange() const

返回细节级别的最小值和最大值参数。

另请参阅 setLevelOfDetailRange()、minimumLevelOfDetail() 和maximumLevelOfDetail()。

float QOpenGLTexture::levelofDetailBias() const

返回细节级别偏差参数。

另请参阅 setLevelofDetailBias()。

QOpenGLTexture::Filter QOpenGLTexture::magnificationFilter() const

返回放大滤镜。

另请参阅 setMagnificationFilter()。

float QOpenGLTexture::maximumAnisotropy() const

返回在执行纹理查找时需考虑的最高各向异性级别。此功能需要 GL_EXT_texture_filter_anisotropic 扩展。

另请参阅 setMaximumAnisotropy()。

float QOpenGLTexture::maximumLevelOfDetail() const

返回最大详细程度参数。

另请参阅 setMaximumLevelOfDetail()、minimumLevelOfDetail(),以及levelOfDetailRange()。

int QOpenGLTexture::maximumMipLevels() const

根据当前尺寸,返回该纹理可拥有的最大Mipmap级别数。

另请参阅 setMipLevels()、mipLevels(),以及setSize()。

std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> QOpenGLTexture::minMagFilters() const

返回当前的压缩和扩展过滤器。

另请参阅 setMinMagFilters()。

QOpenGLTexture::Filter QOpenGLTexture::minificationFilter() const

返回代码压缩过滤器。

另请参阅 setMinificationFilter()。

float QOpenGLTexture::minimumLevelOfDetail() const

返回最低详细程度参数。

另请参阅 setMinimumLevelOfDetail()、maximumLevelOfDetail() 和levelOfDetailRange()。

int QOpenGLTexture::mipBaseLevel() const

返回此纹理所有纹理查找所使用的MIP映射基级。默认值为 0。

另请参阅 setMipBaseLevel()、mipMaxLevel() 以及mipLevelRange()。

std::pair<int, int> QOpenGLTexture::mipLevelRange() const

返回可用于对该纹理进行纹理查找的Mipmap级别范围。

另请参阅 setMipLevelRange()、mipBaseLevel() 和mipMaxLevel()。

int QOpenGLTexture::mipLevels() const

返回此纹理的Mipmap层数。如果尚未为此纹理分配存储空间,则返回请求的Mipmap层数。

另请参阅 setMipLevels()、maximumMipLevels() 和isStorageAllocated()。

int QOpenGLTexture::mipMaxLevel() const

返回此纹理所有纹理查找所使用的Mipmap最大级别。

另请参阅 setMipMaxLevel()、mipBaseLevel()、以及mipLevelRange()。

void QOpenGLTexture::release()

将该纹理从当前活动的纹理单元中解除绑定。

另请参阅 bind()。

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

将此纹理从纹理单元unit 中解除绑定。

如果参数reset 的值为true ,则本函数将把活动单元恢复为调用时处于活动状态的纹理单元。

int QOpenGLTexture::samples() const

返回此纹理的多采样采样点数量。如果尚未为此纹理分配存储空间,则该函数返回请求的采样点数量。

对于不支持多采样的纹理目标,该函数将返回 0。

另请参阅 setSamples() 和isStorageAllocated()。

void QOpenGLTexture::setAutoMipMapGenerationEnabled(bool enabled)

如果 `enabled ` 的值为 `true`,则当通过 `setData()` 设置第 0 级 Mipmap 数据时,将启用该纹理对象的自动 Mipmap 生成功能。

默认情况下,自动 Mipmap 生成功能处于启用状态。

注意: OpenGL ES 2.0 不支持对压缩纹理进行Mipmap 生成。

另请参阅 isAutoMipMapGenerationEnabled() 和generateMipMaps()。

void QOpenGLTexture::setBorderColor(const QColor &color)

将纹理的边框颜色设置为color 。

注意:此 函数在 Mac 以及针对 OpenGL ES 2 构建的 Qt OpenGL 上无效。

另请参阅 borderColor()。

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

将红色设置为r ,绿色设置为g ,蓝色设置为b ,并将a 设为透明度值。

这是一个重载函数。

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

将红色设置为r ,绿色设置为g ,蓝色设置为b ,透明度设置为a 。

这是一个重载函数。

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

将红色设置为r ,绿色设置为g ,蓝色设置为b ,透明度设置为a 。

这是一个重载函数。

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

将此纹理的纹理比较函数设置为function 。阴影采样器在采样深度纹理时会使用该纹理比较函数。

另请参阅 comparisonFunction()。

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

将此纹理的纹理比较模式设置为mode 。阴影采样器在采样深度纹理时会使用该纹理比较模式。

另请参阅 comparisonMode()。

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

将压缩的像素数据data 上传至mipLevel 、数组layer 以及cubeFace 。像素传输可通过options 进行可选控制。dataSize 参数应指定data 所指向的数据的大小。

如果不使用压缩的format(),则应使用setData() 代替此函数。

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

这是一个重载函数。

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

这是一个重载函数。

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

这是一个重载函数。

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

参数layerCount 表示通过此调用上传/填充的纹理数组中的图层数量。

这是一个重载函数。

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

上传该纹理对象mipLevel 的像素数据data 、数组layer 以及cubeFace 。在上传像素数据之前,必须已分配好存储空间。某些 setData() 的重载方法会在具备足够信息的情况下,自动设置适当的尺寸、Mipmap 级别和数组层,并为您分配存储空间。相关说明将在函数文档中注明。

由data 指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可选地通过options 进行控制。

如果使用压缩的format(),则应使用setCompressedData() 代替此函数。

另请参阅 setCompressedData()。

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

setData() 的此重载会为您分配存储空间。像素数据存储在image 中。默认情况下会生成 Mipmap。将genMipMaps 设置为DontGenerateMipMaps 可关闭 Mipmap 的生成。

注意: image 会自动转换为QImage::Format_RGBA8888 ,对于格式不同的较大图像,这可能会影响性能。

这是一个重载函数。

void QOpenGLTexture::setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

这是一个重载函数。

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

这是一个重载函数。

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

这是一个重载函数。

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)

参数layerCount 表示由该调用上传/填充的纹理数组中的图层数量。

这是一个重载函数。

void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

此重载用于更新纹理的一部分。参数xOffset 、yOffset 和zOffset 指定纹理内的纹素偏移量。参数width 、height 和depth 指定子图像的尺寸。

由data 所指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可通过options 进行可选控制。

这是一个重载函数。

void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

此重载用于更新纹理的一部分。参数xOffset 、yOffset 、zOffset 指定纹理内的纹素偏移量。参数width 、height 和depth 指定子图像的尺寸。要更新的子图像的 MIP 贴图级别通过mipLevel 指定。

由data 所指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可通过options 进行可选控制。

这是一个重载函数。

void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

此重载用于更新纹理的一部分。参数xOffset 、yOffset 、zOffset 指定纹理内的纹素偏移量。参数width 、height 和depth 指定子图像的尺寸。要更新的子图像的 MIP 贴图级别和图层分别通过mipLevel 和layer 指定。

data 所指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可通过options 进行可选控制。

这是一个重载函数。

void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace face, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

此重载用于更新纹理的一部分。参数xOffset 、yOffset 、zOffset 指定纹理内的纹素偏移量。参数width 、height 和depth 指定子图像的尺寸。要更新的子图像的 MIP 地图级别、图层和立方体贴图面分别由mipLevel 、layer 和face 指定。

由data 指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可通过options 可选地进行控制。

这是一个重载函数。

void QOpenGLTexture::setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace face, int layerCount, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options = nullptr)

此重载用于更新纹理的一部分。参数xOffset 、yOffset 、zOffset 指定纹理内的纹素偏移量。参数width 、height 和depth 指定子图像的尺寸。要更新的子图像的 MIP 贴图级别、起始层、立方贴图面以及层数分别由mipLevel 、layer 、face 和layerCount 指定。

由data 指向的像素数据结构由sourceFormat 和sourceType 指定。像素数据的上传可通过options 进行可选控制。

这是一个重载函数。

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

如果使用的是采用深度/模板合并格式的纹理,此函数将决定从纹理中访问的哪个分量,该分量被设置为mode 。

当该参数设置为DepthMode 时,着色器访问该纹理时将像往常一样以单个浮点数的形式访问深度分量。但当该参数设置为StencilMode 时,着色器将访问模板分量。

注意:此 函数对 Mac 以及针对 OpenGL ES 2 构建的 Qt OpenGL 版本无效。

另请参阅 depthStencilMode()。

void QOpenGLTexture::setFixedSamplePositions(bool fixed)

用于将支持多采样的纹理目标所使用的采样位置和采样数设置为fixed 。如果设置为true ,则图像中所有纹素使用的采样位置和采样数均相同,且不依赖于图像大小或内部格式。应在为纹理分配存储空间之前调用此函数。

对于不支持多采样的纹理目标,此函数无效。

默认值为true 。

另请参阅 isFixedSamplePositions() 和isStorageAllocated()。

void QOpenGLTexture::setFormat(QOpenGLTexture::TextureFormat format)

将此纹理对象的格式设置为format 。必须在分配纹理存储空间之前调用此函数。

请注意,并非所有格式都受支持。具体支持的格式取决于您的 OpenGL 实现和版本。

另请参阅 format() 和allocateStorage()。

void QOpenGLTexture::setLayers(int layers)

设置要为数组layers 分配存储空间的数量。应在为纹理分配存储空间之前调用此函数。

对于不支持数组图层的目标,此函数无效。

另请参阅 layers() 和isStorageAllocated()。

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

将细节等级的最小值设置为min ,最大值设置为max 。

注意:此 函数对针对 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 levelOfDetailRange()、setMinimumLevelOfDetail() 和setMaximumLevelOfDetail()。

void QOpenGLTexture::setLevelofDetailBias(float bias)

将细节级别偏移量设置为bias 。细节级别偏移量会影响米普映射级别的切换点。增大细节级别偏移量的数值会使整体图像变得更模糊或更平滑;减小该数值则会使整体图像更锐利。

注意:此 函数对针对 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 levelofDetailBias()。

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

将缩放过滤器设置为filter 。

另请参阅 magnificationFilter()、setMinificationFilter() 和setMinMagFilters()。

void QOpenGLTexture::setMaximumAnisotropy(float anisotropy)

如果您的 OpenGL 实现支持 GL_EXT_texture_filter_anisotropic 扩展,则该函数将最大各向异性级别设置为anisotropy 。

另请参阅 maximumAnisotropy()。

void QOpenGLTexture::setMaximumLevelOfDetail(float value)

将最大细节级别设置为value 。这会限制最低分辨率Mipmap(最高Mipmap级别)的选择。默认值为1000。

注意:此 函数对针对 OpenGL ES 2 构建的 Qt OpenGL 无效。

另请参阅 maximumLevelOfDetail()、setMinimumLevelOfDetail() 和setLevelOfDetailRange()。

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

将缩小过滤器设置为minificationFilter ,将放大过滤器设置为magnificationFilter 。

另请参阅 minMagFilters()、setMinificationFilter() 和setMagnificationFilter()。

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

将用于代码压缩的过滤器设置为filter 。

另请参阅 minificationFilter()、setMagnificationFilter() 和setMinMagFilters()。

void QOpenGLTexture::setMinimumLevelOfDetail(float value)

将最低细节级别设置为value 。这会限制最高分辨率米普图(最低米普图级别)的选择。默认值为-1000。

注意:此 函数对针对 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 minimumLevelOfDetail()、setMaximumLevelOfDetail() 和setLevelOfDetailRange()。

void QOpenGLTexture::setMipBaseLevel(int baseLevel)

将此纹理的所有纹理查找所使用的基米普图级别设置为baseLevel 。

注意:此 函数对针对 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 mipBaseLevel()、setMipMaxLevel() 和setMipLevelRange()。

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

将可用于此纹理的纹理查找的微贴图级别范围设置为baseLevel 至maxLevel 。

注意:此 函数对为 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 setMipBaseLevel()、setMipMaxLevel() 和mipLevelRange()。

void QOpenGLTexture::setMipLevels(int levels)

对于支持米普图的纹理目标,此函数用于设置需要为其分配存储空间的米普图levels 的数量。应在为纹理分配存储空间之前调用此函数。

如果纹理目标不支持米普图,则此函数无效。

另请参阅 mipLevels()、maximumMipLevels() 和isStorageAllocated()。

void QOpenGLTexture::setMipMaxLevel(int maxLevel)

将使用该纹理进行所有纹理查找时所用的最大Mipmap级别设置为maxLevel 。

注意:此 函数对为 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 mipMaxLevel()、setMipBaseLevel() 和setMipLevelRange()。

void QOpenGLTexture::setSamples(int samples)

设置在渲染到支持多采样的纹理目标时,为samples 分配存储空间的数量。应在为纹理分配存储空间之前调用此函数。

对于不支持多采样的目标,此函数无效。

另请参阅 samples() 和isStorageAllocated()。

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

将此纹理对象的尺寸设置为width 、height 和depth 。每个维度的默认值为 1。纹理的最大允许尺寸取决于您的 OpenGL 实现。即使为小于最大尺寸的纹理分配存储空间,如果系统资源不足,仍可能失败。

如果提供的width 、height 或depth 不是 2 的幂,且您的 OpenGL 实现不支持重复非 2 的幂纹理,则循环模式将自动设置为ClampToEdge 。

另请参阅 width()、height() 和depth()。

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

GLSL 着色器能够重新排列纹理函数返回的 vec4 的分量顺序。此外,能够从 CPU 端代码控制这种重新排列也是非常理想的。自 OpenGL 3.3 起,通过 swizzle 掩码可以实现这一点。

纹理的每个分量都可以映射到SwizzleValue 选项之一。

该函数将component 映射到输出value 。

注意:此 函数对 Mac 以及为 OpenGL ES 2 构建的 Qt OpenGL 没有影响。

另请参阅 swizzleMask()。

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

参数r 、g 、b 和a 分别用于设置红色、绿色、蓝色以及透明度值。

这是一个重载函数。

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

将所有纹理尺寸的环绕(或重复)模式设置为mode 。

另请参阅 wrapMode()。

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

将纹理维度direction 的环绕(或重复)模式设置为mode 。

这是一个重载函数。

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

返回纹理component 的混色掩码。

另请参阅 setSwizzleMask()。

QOpenGLTexture::Target QOpenGLTexture::target() const

返回该纹理的绑定目标。

GLuint QOpenGLTexture::textureId() const

返回底层 OpenGL 纹理对象的名称;如果该对象尚未创建,则返回 0。

另请参阅 create()、destroy() 和isCreated()。

int QOpenGLTexture::width() const

返回 1D、2D 或 3D 纹理的宽度。

另请参阅 height()、depth() 和setSize()。

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

返回纹理维度direction 的包围模式。

另请参阅 setWrapMode()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.