28 Target1DArray = 0x8C18,
30 Target2DArray = 0x8C1A,
32 TargetCubeMap = 0x8513,
33 TargetCubeMapArray = 0x9009,
34 Target2DMultisample = 0x9100,
35 Target2DMultisampleArray = 0x9102,
36 TargetRectangle = 0x84F5,
42 BindingTarget1D = 0x8068,
43 BindingTarget1DArray = 0x8C1C,
44 BindingTarget2D = 0x8069,
45 BindingTarget2DArray = 0x8C1D,
46 BindingTarget3D = 0x806A,
47 BindingTargetCubeMap = 0x8514,
48 BindingTargetCubeMapArray = 0x900A,
49 BindingTarget2DMultisample = 0x9104,
50 BindingTarget2DMultisampleArray = 0x9105,
51 BindingTargetRectangle = 0x84F6,
52 BindingTargetBuffer = 0x8C2C
56 enum MipMapGeneration {
60 Q_ENUM(MipMapGeneration)
62 enum TextureUnitReset {
66 Q_ENUM(TextureUnitReset)
80 RGBA16_UNorm = 0x805B,
91 RGBA16_SNorm = 0x8F9B,
159 R_ATI1N_UNorm = 0x8DBB,
160 R_ATI1N_SNorm = 0x8DBC,
161 RG_ATI2N_UNorm = 0x8DBD,
162 RG_ATI2N_SNorm = 0x8DBE,
163 RGB_BP_UNSIGNED_FLOAT = 0x8E8F,
164 RGB_BP_SIGNED_FLOAT = 0x8E8E,
165 RGB_BP_UNorm = 0x8E8C,
166 R11_EAC_UNorm = 0x9270,
167 R11_EAC_SNorm = 0x9271,
168 RG11_EAC_UNorm = 0x9272,
169 RG11_EAC_SNorm = 0x9273,
172 RGB8_PunchThrough_Alpha1_ETC2 = 0x9276,
173 SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277,
174 RGBA8_ETC2_EAC = 0x9278,
175 SRGB8_Alpha8_ETC2_EAC = 0x9279,
177 RGBA_ASTC_4x4 = 0x93B0,
178 RGBA_ASTC_5x4 = 0x93B1,
179 RGBA_ASTC_5x5 = 0x93B2,
180 RGBA_ASTC_6x5 = 0x93B3,
181 RGBA_ASTC_6x6 = 0x93B4,
182 RGBA_ASTC_8x5 = 0x93B5,
183 RGBA_ASTC_8x6 = 0x93B6,
184 RGBA_ASTC_8x8 = 0x93B7,
185 RGBA_ASTC_10x5 = 0x93B8,
186 RGBA_ASTC_10x6 = 0x93B9,
187 RGBA_ASTC_10x8 = 0x93BA,
188 RGBA_ASTC_10x10 = 0x93BB,
189 RGBA_ASTC_12x10 = 0x93BC,
190 RGBA_ASTC_12x12 = 0x93BD,
191 SRGB8_Alpha8_ASTC_4x4 = 0x93D0,
192 SRGB8_Alpha8_ASTC_5x4 = 0x93D1,
193 SRGB8_Alpha8_ASTC_5x5 = 0x93D2,
194 SRGB8_Alpha8_ASTC_6x5 = 0x93D3,
195 SRGB8_Alpha8_ASTC_6x6 = 0x93D4,
196 SRGB8_Alpha8_ASTC_8x5 = 0x93D5,
197 SRGB8_Alpha8_ASTC_8x6 = 0x93D6,
198 SRGB8_Alpha8_ASTC_8x8 = 0x93D7,
199 SRGB8_Alpha8_ASTC_10x5 = 0x93D8,
200 SRGB8_Alpha8_ASTC_10x6 = 0x93D9,
201 SRGB8_Alpha8_ASTC_10x8 = 0x93DA,
202 SRGB8_Alpha8_ASTC_10x10 = 0x93DB,
203 SRGB8_Alpha8_ASTC_12x10 = 0x93DC,
204 SRGB8_Alpha8_ASTC_12x12 = 0x93DD,
208 SRGB8_Alpha8 = 0x8C43,
210 SRGB_Alpha_DXT1 = 0x8C4D,
211 SRGB_Alpha_DXT3 = 0x8C4E,
212 SRGB_Alpha_DXT5 = 0x8C4F,
213 SRGB_BP_UNorm = 0x8E8D,
216 DepthFormat = 0x1902,
217 AlphaFormat = 0x1906,
220 LuminanceFormat = 0x1909,
221 LuminanceAlphaFormat = 0x190A
224 Q_ENUM(TextureFormat)
229 enum TextureFormatClass {
240 FormatClass_RGTC2_RG,
241 FormatClass_BPTC_Unorm,
242 FormatClass_BPTC_Float,
243 FormatClass_S3TC_DXT1_RGB,
244 FormatClass_S3TC_DXT1_RGBA,
245 FormatClass_S3TC_DXT3_RGBA,
246 FormatClass_S3TC_DXT5_RGBA,
252 CubeMapPositiveX = 0x8515,
253 CubeMapNegativeX = 0x8516,
254 CubeMapPositiveY = 0x8517,
255 CubeMapNegativeY = 0x8518,
256 CubeMapPositiveZ = 0x8519,
257 CubeMapNegativeZ = 0x851A
269 Red_Integer = 0x8D94,
271 RGB_Integer = 0x8D98,
272 BGR_Integer = 0x8D9A,
273 RGBA_Integer = 0x8D99,
274 BGRA_Integer = 0x8D9B,
277 DepthStencil = 0x84F9,
280 LuminanceAlpha = 0x190A
295 UInt32_RGB9_E5 = 0x8C3E,
296 UInt32_RG11B10F = 0x8C3B,
297 UInt8_RG3B2 = 0x8032,
298 UInt8_RG3B2_Rev = 0x8362,
299 UInt16_RGB5A1 = 0x8034,
300 UInt16_RGB5A1_Rev = 0x8366,
301 UInt16_R5G6B5 = 0x8363,
302 UInt16_R5G6B5_Rev = 0x8364,
303 UInt16_RGBA4 = 0x8033,
304 UInt16_RGBA4_Rev = 0x8365,
305 UInt32_RGBA8 = 0x8035,
306 UInt32_RGBA8_Rev = 0x8367,
307 UInt32_RGB10A2 = 0x8036,
308 UInt32_RGB10A2_Rev = 0x8368,
309 UInt32_D24S8 = 0x84FA,
310 Float32_D32_UInt32_S8_X24 = 0x8DAD
314 enum SwizzleComponent {
316 SwizzleGreen = 0x8E43,
317 SwizzleBlue = 0x8E44,
318 SwizzleAlpha = 0x8E45
320 Q_ENUM(SwizzleComponent)
334 MirroredRepeat = 0x8370,
335 ClampToEdge = 0x812F,
336 ClampToBorder = 0x812D
340 enum CoordinateDirection {
345 Q_ENUM(CoordinateDirection)
349 ImmutableStorage = 0x00000001,
350 ImmutableMultisampleStorage = 0x00000002,
351 TextureRectangle = 0x00000004,
352 TextureArrays = 0x00000008,
353 Texture3D = 0x00000010,
354 TextureMultisample = 0x00000020,
355 TextureBuffer = 0x00000040,
356 TextureCubeMapArrays = 0x00000080,
357 Swizzle = 0x00000100,
358 StencilTexturing = 0x00000200,
359 AnisotropicFiltering = 0x00000400,
360 NPOTTextures = 0x00000800,
361 NPOTTextureRepeat = 0x00001000,
362 Texture1D = 0x00002000,
363 TextureComparisonOperators = 0x00004000,
364 TextureMipMapLevel = 0x00008000,
366 MaxFeatureFlag = 0x00010000
369 Q_DECLARE_FLAGS(Features, Feature)
372 explicit QOpenGLTexture(Target target);
373 explicit QOpenGLTexture(
const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
376 Target target()
const;
381 bool isCreated()
const;
382 GLuint textureId()
const;
386 void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
388 void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
390 bool isBound()
const;
391 bool isBound(uint unit);
392 static GLuint boundTextureId(BindingTarget target);
393 static GLuint boundTextureId(uint unit, BindingTarget target);
396 void setFormat(TextureFormat format);
397 TextureFormat format()
const;
398 void setSize(
int width,
int height = 1,
int depth = 1);
402 void setMipLevels(
int levels);
403 int mipLevels()
const;
404 int maximumMipLevels()
const;
405 void setLayers(
int layers);
408 void setSamples(
int samples);
410 void setFixedSamplePositions(
bool fixed);
411 bool isFixedSamplePositions()
const;
412 void allocateStorage();
413 void allocateStorage(PixelFormat pixelFormat, PixelType pixelType);
414 bool isStorageAllocated()
const;
416 QOpenGLTexture *createTextureView(Target target,
417 TextureFormat viewFormat,
418 int minimumMipmapLevel,
int maximumMipmapLevel,
419 int minimumLayer,
int maximumLayer)
const;
420 bool isTextureView()
const;
423 void setData(
int mipLevel,
int layer, CubeMapFace cubeFace,
424 PixelFormat sourceFormat, PixelType sourceType,
425 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
426 void setData(
int mipLevel,
int layer,
int layerCount, CubeMapFace cubeFace,
427 PixelFormat sourceFormat, PixelType sourceType,
428 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
429 void setData(
int mipLevel,
int layer,
430 PixelFormat sourceFormat, PixelType sourceType,
431 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
432 void setData(
int mipLevel,
433 PixelFormat sourceFormat, PixelType sourceType,
434 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
435 void setData(PixelFormat sourceFormat, PixelType sourceType,
436 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
438 void setData(
int xOffset,
int yOffset,
int zOffset,
439 int width,
int height,
int depth,
440 PixelFormat sourceFormat, PixelType sourceType,
441 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
442 void setData(
int xOffset,
int yOffset,
int zOffset,
443 int width,
int height,
int depth,
int mipLevel,
444 PixelFormat sourceFormat, PixelType sourceType,
445 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
446 void setData(
int xOffset,
int yOffset,
int zOffset,
447 int width,
int height,
int depth,
448 int mipLevel,
int layer,
449 PixelFormat sourceFormat, PixelType sourceType,
450 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
451 void setData(
int xOffset,
int yOffset,
int zOffset,
452 int width,
int height,
int depth,
453 int mipLevel,
int layer,
454 CubeMapFace cubeFace,
455 PixelFormat sourceFormat, PixelType sourceType,
456 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
457 void setData(
int xOffset,
int yOffset,
int zOffset,
458 int width,
int height,
int depth,
459 int mipLevel,
int layer,
460 CubeMapFace cubeFace,
int layerCount,
461 PixelFormat sourceFormat, PixelType sourceType,
462 const void *data,
const QOpenGLPixelTransferOptions *
const options =
nullptr);
465 void setCompressedData(
int mipLevel,
int layer, CubeMapFace cubeFace,
466 int dataSize,
const void *data,
467 const QOpenGLPixelTransferOptions *
const options =
nullptr);
468 void setCompressedData(
int mipLevel,
int layer,
int layerCount, CubeMapFace cubeFace,
469 int dataSize,
const void *data,
470 const QOpenGLPixelTransferOptions *
const options =
nullptr);
471 void setCompressedData(
int mipLevel,
int layer,
472 int dataSize,
const void *data,
473 const QOpenGLPixelTransferOptions *
const options =
nullptr);
474 void setCompressedData(
int mipLevel,
int dataSize,
const void *data,
475 const QOpenGLPixelTransferOptions *
const options =
nullptr);
476 void setCompressedData(
int dataSize,
const void *data,
477 const QOpenGLPixelTransferOptions *
const options =
nullptr);
480 void setData(
const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
482 static bool hasFeature(Feature feature);
485 void setMipBaseLevel(
int baseLevel);
486 int mipBaseLevel()
const;
487 void setMipMaxLevel(
int maxLevel);
488 int mipMaxLevel()
const;
489 void setMipLevelRange(
int baseLevel,
int maxLevel);
490 std::pair<
int,
int> mipLevelRange()
const;
492 void setAutoMipMapGenerationEnabled(
bool enabled);
493 bool isAutoMipMapGenerationEnabled()
const;
495 void generateMipMaps();
496 void generateMipMaps(
int baseLevel,
bool resetBaseLevel =
true);
498 void setSwizzleMask(SwizzleComponent component, SwizzleValue value);
499 void setSwizzleMask(SwizzleValue r, SwizzleValue g,
500 SwizzleValue b, SwizzleValue a);
501 SwizzleValue swizzleMask(SwizzleComponent component)
const;
503 enum DepthStencilMode {
507 Q_ENUM(DepthStencilMode)
509 void setDepthStencilMode(DepthStencilMode mode);
510 DepthStencilMode depthStencilMode()
const;
512 enum ComparisonFunction {
513 CompareLessEqual = 0x0203,
514 CompareGreaterEqual = 0x0206,
515 CompareLess = 0x0201,
516 CompareGreater = 0x0204,
517 CompareEqual = 0x0202,
518 CompareNotEqual = 0x0205,
519 CompareAlways = 0x0207,
520 CompareNever = 0x0200,
522#if QT_DEPRECATED_SINCE(6
, 1
)
523 CommpareNotEqual Q_DECL_ENUMERATOR_DEPRECATED_X(
524 "Use CompareNotEqual instead.") = CompareNotEqual
527 Q_ENUM(ComparisonFunction)
529 void setComparisonFunction(ComparisonFunction function);
530 ComparisonFunction comparisonFunction()
const;
532 enum ComparisonMode {
533 CompareRefToTexture = 0x884E,
537 void setComparisonMode(ComparisonMode mode);
538 ComparisonMode comparisonMode()
const;
544 NearestMipMapNearest = 0x2700,
545 NearestMipMapLinear = 0x2702,
546 LinearMipMapNearest = 0x2701,
547 LinearMipMapLinear = 0x2703
551 void setMinificationFilter(Filter filter);
552 Filter minificationFilter()
const;
553 void setMagnificationFilter(Filter filter);
554 Filter magnificationFilter()
const;
555 void setMinMagFilters(Filter minificationFilter,
556 Filter magnificationFilter);
557 std::pair<Filter, Filter> minMagFilters()
const;
558 void setMaximumAnisotropy(
float anisotropy);
559 float maximumAnisotropy()
const;
561 void setWrapMode(WrapMode mode);
562 void setWrapMode(CoordinateDirection direction, WrapMode mode);
563 WrapMode wrapMode(CoordinateDirection direction)
const;
565 void setBorderColor(
const QColor &color);
566 void setBorderColor(
float r,
float g,
float b,
float a);
567 void setBorderColor(
int r,
int g,
int b,
int a);
568 void setBorderColor(uint r, uint g, uint b, uint a);
570 QColor borderColor()
const;
571 void borderColor(
float *border)
const;
572 void borderColor(
int *border)
const;
573 void borderColor(
unsigned int *border)
const;
575 void setMinimumLevelOfDetail(
float value);
576 float minimumLevelOfDetail()
const;
577 void setMaximumLevelOfDetail(
float value);
578 float maximumLevelOfDetail()
const;
579 void setLevelOfDetailRange(
float min,
float max);
580 std::pair<
float,
float> levelOfDetailRange()
const;
581 void setLevelofDetailBias(
float bias);
582 float levelofDetailBias()
const;
584#ifndef QT_NO_DEBUG_STREAM
585 friend Q_OPENGL_EXPORT QDebug operator<<(QDebug dbg,
const QOpenGLTexture *t);
589 Q_DISABLE_COPY(QOpenGLTexture)
590 Q_DECLARE_PRIVATE(QOpenGLTexture)
591 QScopedPointer<QOpenGLTexturePrivate> d_ptr;
void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode)
void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options)
void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options)
void release(uint unit, QOpenGLTexture::TextureUnitReset reset=QOpenGLTexture::DontResetTextureUnit)
QOpenGLTexture * createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const
void bind(uint unit, QOpenGLTexture::TextureUnitReset reset=QOpenGLTexture::DontResetTextureUnit)
void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options)
static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
static bool isNpot(int width, int height=1, int depth=1)
static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat)
static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat)