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