1// qopengltexture.sip generated by MetaSIP 2// 3// This file is part of the QtGui Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23%If (Qt_5_2_0 -) 24%If (PyQt_OpenGL) 25 26class QOpenGLTexture 27{ 28%TypeHeaderCode 29#include <qopengltexture.h> 30%End 31 32public: 33 enum Target 34 { 35 Target1D, 36 Target1DArray, 37 Target2D, 38 Target2DArray, 39 Target3D, 40 TargetCubeMap, 41 TargetCubeMapArray, 42 Target2DMultisample, 43 Target2DMultisampleArray, 44 TargetRectangle, 45 TargetBuffer, 46 }; 47 48 enum BindingTarget 49 { 50 BindingTarget1D, 51 BindingTarget1DArray, 52 BindingTarget2D, 53 BindingTarget2DArray, 54 BindingTarget3D, 55 BindingTargetCubeMap, 56 BindingTargetCubeMapArray, 57 BindingTarget2DMultisample, 58 BindingTarget2DMultisampleArray, 59 BindingTargetRectangle, 60 BindingTargetBuffer, 61 }; 62 63 enum MipMapGeneration 64 { 65 GenerateMipMaps, 66 DontGenerateMipMaps, 67 }; 68 69 enum TextureUnitReset 70 { 71 ResetTextureUnit, 72 DontResetTextureUnit, 73 }; 74 75 explicit QOpenGLTexture(QOpenGLTexture::Target target); 76 QOpenGLTexture(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps); 77 ~QOpenGLTexture(); 78 bool create(); 79 void destroy(); 80 bool isCreated() const; 81 GLuint textureId() const; 82 void bind(); 83 void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit); 84 void release(); 85 void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit); 86 bool isBound() const; 87 bool isBound(uint unit); 88 static GLuint boundTextureId(QOpenGLTexture::BindingTarget target); 89 static GLuint boundTextureId(uint unit, QOpenGLTexture::BindingTarget target); 90 91 enum TextureFormat 92 { 93 NoFormat, 94 R8_UNorm, 95 RG8_UNorm, 96 RGB8_UNorm, 97 RGBA8_UNorm, 98 R16_UNorm, 99 RG16_UNorm, 100 RGB16_UNorm, 101 RGBA16_UNorm, 102 R8_SNorm, 103 RG8_SNorm, 104 RGB8_SNorm, 105 RGBA8_SNorm, 106 R16_SNorm, 107 RG16_SNorm, 108 RGB16_SNorm, 109 RGBA16_SNorm, 110 R8U, 111 RG8U, 112 RGB8U, 113 RGBA8U, 114 R16U, 115 RG16U, 116 RGB16U, 117 RGBA16U, 118 R32U, 119 RG32U, 120 RGB32U, 121 RGBA32U, 122 R8I, 123 RG8I, 124 RGB8I, 125 RGBA8I, 126 R16I, 127 RG16I, 128 RGB16I, 129 RGBA16I, 130 R32I, 131 RG32I, 132 RGB32I, 133 RGBA32I, 134 R16F, 135 RG16F, 136 RGB16F, 137 RGBA16F, 138 R32F, 139 RG32F, 140 RGB32F, 141 RGBA32F, 142 RGB9E5, 143 RG11B10F, 144 RG3B2, 145 R5G6B5, 146 RGB5A1, 147 RGBA4, 148 RGB10A2, 149 D16, 150 D24, 151 D24S8, 152 D32, 153 D32F, 154 D32FS8X24, 155 RGB_DXT1, 156 RGBA_DXT1, 157 RGBA_DXT3, 158 RGBA_DXT5, 159 R_ATI1N_UNorm, 160 R_ATI1N_SNorm, 161 RG_ATI2N_UNorm, 162 RG_ATI2N_SNorm, 163 RGB_BP_UNSIGNED_FLOAT, 164 RGB_BP_SIGNED_FLOAT, 165 RGB_BP_UNorm, 166 SRGB8, 167 SRGB8_Alpha8, 168 SRGB_DXT1, 169 SRGB_Alpha_DXT1, 170 SRGB_Alpha_DXT3, 171 SRGB_Alpha_DXT5, 172 SRGB_BP_UNorm, 173 DepthFormat, 174 AlphaFormat, 175 RGBFormat, 176 RGBAFormat, 177 LuminanceFormat, 178 LuminanceAlphaFormat, 179%If (Qt_5_4_0 -) 180 S8, 181%End 182%If (Qt_5_5_0 -) 183 R11_EAC_UNorm, 184%End 185%If (Qt_5_5_0 -) 186 R11_EAC_SNorm, 187%End 188%If (Qt_5_5_0 -) 189 RG11_EAC_UNorm, 190%End 191%If (Qt_5_5_0 -) 192 RG11_EAC_SNorm, 193%End 194%If (Qt_5_5_0 -) 195 RGB8_ETC2, 196%End 197%If (Qt_5_5_0 -) 198 SRGB8_ETC2, 199%End 200%If (Qt_5_5_0 -) 201 RGB8_PunchThrough_Alpha1_ETC2, 202%End 203%If (Qt_5_5_0 -) 204 SRGB8_PunchThrough_Alpha1_ETC2, 205%End 206%If (Qt_5_5_0 -) 207 RGBA8_ETC2_EAC, 208%End 209%If (Qt_5_5_0 -) 210 SRGB8_Alpha8_ETC2_EAC, 211%End 212%If (Qt_5_6_0 -) 213 RGB8_ETC1, 214%End 215%If (Qt_5_9_0 -) 216 RGBA_ASTC_4x4, 217%End 218%If (Qt_5_9_0 -) 219 RGBA_ASTC_5x4, 220%End 221%If (Qt_5_9_0 -) 222 RGBA_ASTC_5x5, 223%End 224%If (Qt_5_9_0 -) 225 RGBA_ASTC_6x5, 226%End 227%If (Qt_5_9_0 -) 228 RGBA_ASTC_6x6, 229%End 230%If (Qt_5_9_0 -) 231 RGBA_ASTC_8x5, 232%End 233%If (Qt_5_9_0 -) 234 RGBA_ASTC_8x6, 235%End 236%If (Qt_5_9_0 -) 237 RGBA_ASTC_8x8, 238%End 239%If (Qt_5_9_0 -) 240 RGBA_ASTC_10x5, 241%End 242%If (Qt_5_9_0 -) 243 RGBA_ASTC_10x6, 244%End 245%If (Qt_5_9_0 -) 246 RGBA_ASTC_10x8, 247%End 248%If (Qt_5_9_0 -) 249 RGBA_ASTC_10x10, 250%End 251%If (Qt_5_9_0 -) 252 RGBA_ASTC_12x10, 253%End 254%If (Qt_5_9_0 -) 255 RGBA_ASTC_12x12, 256%End 257%If (Qt_5_9_0 -) 258 SRGB8_Alpha8_ASTC_4x4, 259%End 260%If (Qt_5_9_0 -) 261 SRGB8_Alpha8_ASTC_5x4, 262%End 263%If (Qt_5_9_0 -) 264 SRGB8_Alpha8_ASTC_5x5, 265%End 266%If (Qt_5_9_0 -) 267 SRGB8_Alpha8_ASTC_6x5, 268%End 269%If (Qt_5_9_0 -) 270 SRGB8_Alpha8_ASTC_6x6, 271%End 272%If (Qt_5_9_0 -) 273 SRGB8_Alpha8_ASTC_8x5, 274%End 275%If (Qt_5_9_0 -) 276 SRGB8_Alpha8_ASTC_8x6, 277%End 278%If (Qt_5_9_0 -) 279 SRGB8_Alpha8_ASTC_8x8, 280%End 281%If (Qt_5_9_0 -) 282 SRGB8_Alpha8_ASTC_10x5, 283%End 284%If (Qt_5_9_0 -) 285 SRGB8_Alpha8_ASTC_10x6, 286%End 287%If (Qt_5_9_0 -) 288 SRGB8_Alpha8_ASTC_10x8, 289%End 290%If (Qt_5_9_0 -) 291 SRGB8_Alpha8_ASTC_10x10, 292%End 293%If (Qt_5_9_0 -) 294 SRGB8_Alpha8_ASTC_12x10, 295%End 296%If (Qt_5_9_0 -) 297 SRGB8_Alpha8_ASTC_12x12, 298%End 299 }; 300 301 void setFormat(QOpenGLTexture::TextureFormat format); 302 QOpenGLTexture::TextureFormat format() const; 303 void setSize(int width, int height = 1, int depth = 1); 304 int width() const; 305 int height() const; 306 int depth() const; 307 void setMipLevels(int levels); 308 int mipLevels() const; 309 int maximumMipLevels() const; 310 void setLayers(int layers); 311 int layers() const; 312 int faces() const; 313 void allocateStorage(); 314%If (Qt_5_5_0 -) 315 void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType); 316%End 317 bool isStorageAllocated() const; 318 QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const /Factory/; 319 bool isTextureView() const; 320 321 enum CubeMapFace 322 { 323 CubeMapPositiveX, 324 CubeMapNegativeX, 325 CubeMapPositiveY, 326 CubeMapNegativeY, 327 CubeMapPositiveZ, 328 CubeMapNegativeZ, 329 }; 330 331 enum PixelFormat 332 { 333 NoSourceFormat, 334 Red, 335 RG, 336 RGB, 337 BGR, 338 RGBA, 339 BGRA, 340 Red_Integer, 341 RG_Integer, 342 RGB_Integer, 343 BGR_Integer, 344 RGBA_Integer, 345 BGRA_Integer, 346 Depth, 347 DepthStencil, 348 Alpha, 349 Luminance, 350 LuminanceAlpha, 351%If (Qt_5_4_0 -) 352 Stencil, 353%End 354 }; 355 356 enum PixelType 357 { 358 NoPixelType, 359 Int8, 360 UInt8, 361 Int16, 362 UInt16, 363 Int32, 364 UInt32, 365 Float16, 366 Float16OES, 367 Float32, 368 UInt32_RGB9_E5, 369 UInt32_RG11B10F, 370 UInt8_RG3B2, 371 UInt8_RG3B2_Rev, 372 UInt16_RGB5A1, 373 UInt16_RGB5A1_Rev, 374 UInt16_R5G6B5, 375 UInt16_R5G6B5_Rev, 376 UInt16_RGBA4, 377 UInt16_RGBA4_Rev, 378 UInt32_RGB10A2, 379 UInt32_RGB10A2_Rev, 380%If (Qt_5_4_0 -) 381 UInt32_RGBA8, 382%End 383%If (Qt_5_4_0 -) 384 UInt32_RGBA8_Rev, 385%End 386%If (Qt_5_4_0 -) 387 UInt32_D24S8, 388%End 389%If (Qt_5_4_0 -) 390 Float32_D32_UInt32_S8_X24, 391%End 392 }; 393 394%If (Qt_5_3_0 -) 395 void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 396%End 397%If (- Qt_5_3_0) 398 void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, void *data, const QOpenGLPixelTransferOptions * const options = 0); 399%End 400%If (Qt_5_3_0 -) 401 void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 402%End 403%If (- Qt_5_3_0) 404 void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, void *data, const QOpenGLPixelTransferOptions * const options = 0); 405%End 406%If (Qt_5_3_0 -) 407 void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 408%End 409%If (- Qt_5_3_0) 410 void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, void *data, const QOpenGLPixelTransferOptions * const options = 0); 411%End 412%If (Qt_5_3_0 -) 413 void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 414%End 415%If (- Qt_5_3_0) 416 void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, void *data, const QOpenGLPixelTransferOptions * const options = 0); 417%End 418 void setData(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps); 419%If (Qt_5_3_0 -) 420 void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 421%End 422%If (- Qt_5_3_0) 423 void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, void *data, const QOpenGLPixelTransferOptions * const options = 0); 424%End 425%If (Qt_5_3_0 -) 426 void setCompressedData(int mipLevel, int layer, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 427%End 428%If (- Qt_5_3_0) 429 void setCompressedData(int mipLevel, int layer, int dataSize, void *data, const QOpenGLPixelTransferOptions * const options = 0); 430%End 431%If (Qt_5_3_0 -) 432 void setCompressedData(int mipLevel, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 433%End 434%If (- Qt_5_3_0) 435 void setCompressedData(int mipLevel, int dataSize, void *data, const QOpenGLPixelTransferOptions * const options = 0); 436%End 437%If (Qt_5_3_0 -) 438 void setCompressedData(int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 439%End 440%If (- Qt_5_3_0) 441 void setCompressedData(int dataSize, void *data, const QOpenGLPixelTransferOptions * const options = 0); 442%End 443 444 enum Feature 445 { 446 ImmutableStorage, 447 ImmutableMultisampleStorage, 448 TextureRectangle, 449 TextureArrays, 450 Texture3D, 451 TextureMultisample, 452 TextureBuffer, 453 TextureCubeMapArrays, 454 Swizzle, 455 StencilTexturing, 456 AnisotropicFiltering, 457 NPOTTextures, 458 NPOTTextureRepeat, 459%If (Qt_5_3_0 -) 460 Texture1D, 461%End 462%If (Qt_5_5_0 -) 463 TextureComparisonOperators, 464%End 465%If (Qt_5_5_0 -) 466 TextureMipMapLevel, 467%End 468 }; 469 470 typedef QFlags<QOpenGLTexture::Feature> Features; 471 static bool hasFeature(QOpenGLTexture::Feature feature); 472 void setMipBaseLevel(int baseLevel); 473 int mipBaseLevel() const; 474 void setMipMaxLevel(int maxLevel); 475 int mipMaxLevel() const; 476 void setMipLevelRange(int baseLevel, int maxLevel); 477 QPair<int, int> mipLevelRange() const; 478 void setAutoMipMapGenerationEnabled(bool enabled); 479 bool isAutoMipMapGenerationEnabled() const; 480 void generateMipMaps(); 481 void generateMipMaps(int baseLevel, bool resetBaseLevel = true); 482 483 enum SwizzleComponent 484 { 485 SwizzleRed, 486 SwizzleGreen, 487 SwizzleBlue, 488 SwizzleAlpha, 489 }; 490 491 enum SwizzleValue 492 { 493 RedValue, 494 GreenValue, 495 BlueValue, 496 AlphaValue, 497 ZeroValue, 498 OneValue, 499 }; 500 501 void setSwizzleMask(QOpenGLTexture::SwizzleComponent component, QOpenGLTexture::SwizzleValue value); 502 void setSwizzleMask(QOpenGLTexture::SwizzleValue r, QOpenGLTexture::SwizzleValue g, QOpenGLTexture::SwizzleValue b, QOpenGLTexture::SwizzleValue a); 503 QOpenGLTexture::SwizzleValue swizzleMask(QOpenGLTexture::SwizzleComponent component) const; 504 505 enum DepthStencilMode 506 { 507 DepthMode, 508 StencilMode, 509 }; 510 511 void setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode); 512 QOpenGLTexture::DepthStencilMode depthStencilMode() const; 513 514 enum Filter 515 { 516 Nearest, 517 Linear, 518 NearestMipMapNearest, 519 NearestMipMapLinear, 520 LinearMipMapNearest, 521 LinearMipMapLinear, 522 }; 523 524 void setMinificationFilter(QOpenGLTexture::Filter filter); 525 QOpenGLTexture::Filter minificationFilter() const; 526 void setMagnificationFilter(QOpenGLTexture::Filter filter); 527 QOpenGLTexture::Filter magnificationFilter() const; 528 void setMinMagFilters(QOpenGLTexture::Filter minificationFilter, QOpenGLTexture::Filter magnificationFilter); 529 QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> minMagFilters() const; 530 void setMaximumAnisotropy(float anisotropy); 531 float maximumAnisotropy() const; 532 533 enum WrapMode 534 { 535 Repeat, 536 MirroredRepeat, 537 ClampToEdge, 538 ClampToBorder, 539 }; 540 541 enum CoordinateDirection 542 { 543 DirectionS, 544 DirectionT, 545 DirectionR, 546 }; 547 548 void setWrapMode(QOpenGLTexture::WrapMode mode); 549 void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode); 550 QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const; 551 void setBorderColor(QColor color); 552 QColor borderColor() const; 553 void setMinimumLevelOfDetail(float value); 554 float minimumLevelOfDetail() const; 555 void setMaximumLevelOfDetail(float value); 556 float maximumLevelOfDetail() const; 557 void setLevelOfDetailRange(float min, float max); 558 QPair<float, float> levelOfDetailRange() const; 559 void setLevelofDetailBias(float bias); 560 float levelofDetailBias() const; 561%If (Qt_5_4_0 -) 562 QOpenGLTexture::Target target() const; 563%End 564%If (Qt_5_4_0 -) 565 void setSamples(int samples); 566%End 567%If (Qt_5_4_0 -) 568 int samples() const; 569%End 570%If (Qt_5_4_0 -) 571 void setFixedSamplePositions(bool fixed); 572%End 573%If (Qt_5_4_0 -) 574 bool isFixedSamplePositions() const; 575%End 576%If (Qt_5_5_0 -) 577 578 enum ComparisonFunction 579 { 580 CompareLessEqual, 581 CompareGreaterEqual, 582 CompareLess, 583 CompareGreater, 584 CompareEqual, 585 CommpareNotEqual, 586 CompareAlways, 587 CompareNever, 588 }; 589 590%End 591%If (Qt_5_5_0 -) 592 void setComparisonFunction(QOpenGLTexture::ComparisonFunction function); 593%End 594%If (Qt_5_5_0 -) 595 QOpenGLTexture::ComparisonFunction comparisonFunction() const; 596%End 597%If (Qt_5_5_0 -) 598 599 enum ComparisonMode 600 { 601 CompareRefToTexture, 602 CompareNone, 603 }; 604 605%End 606%If (Qt_5_5_0 -) 607 void setComparisonMode(QOpenGLTexture::ComparisonMode mode); 608%End 609%If (Qt_5_5_0 -) 610 QOpenGLTexture::ComparisonMode comparisonMode() const; 611%End 612%If (Qt_5_9_0 -) 613 void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 614%End 615%If (Qt_5_9_0 -) 616 void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 617%End 618%If (Qt_5_14_0 -) 619 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 = 0); 620%End 621%If (Qt_5_14_0 -) 622 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 = 0); 623%End 624%If (Qt_5_14_0 -) 625 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 = 0); 626%End 627%If (Qt_5_14_0 -) 628 void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 629%End 630%If (Qt_5_14_0 -) 631 void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int layerCount, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); 632%End 633 634private: 635 QOpenGLTexture(const QOpenGLTexture &); 636}; 637 638%End 639%End 640%If (Qt_5_2_0 -) 641%If (PyQt_OpenGL) 642QFlags<QOpenGLTexture::Feature> operator|(QOpenGLTexture::Feature f1, QFlags<QOpenGLTexture::Feature> f2); 643%End 644%End 645