Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:12:17

0001 // Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QOPENGLABSTRACTTEXTURE_H
0005 #define QOPENGLABSTRACTTEXTURE_H
0006 
0007 #include <QtOpenGL/qtopenglglobal.h>
0008 
0009 #ifndef QT_NO_OPENGL
0010 
0011 #include <QtGui/qopengl.h>
0012 #include <QtGui/qimage.h>
0013 #include <QtCore/QScopedPointer>
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 class QDebug;
0018 class QOpenGLTexturePrivate;
0019 class QOpenGLPixelTransferOptions;
0020 
0021 class Q_OPENGL_EXPORT QOpenGLTexture
0022 {
0023     Q_GADGET
0024 public:
0025     enum Target {
0026         Target1D                   = 0x0DE0,    // GL_TEXTURE_1D
0027         Target1DArray              = 0x8C18,    // GL_TEXTURE_1D_ARRAY
0028         Target2D                   = 0x0DE1,    // GL_TEXTURE_2D
0029         Target2DArray              = 0x8C1A,    // GL_TEXTURE_2D_ARRAY
0030         Target3D                   = 0x806F,    // GL_TEXTURE_3D
0031         TargetCubeMap              = 0x8513,    // GL_TEXTURE_CUBE_MAP
0032         TargetCubeMapArray         = 0x9009,    // GL_TEXTURE_CUBE_MAP_ARRAY
0033         Target2DMultisample        = 0x9100,    // GL_TEXTURE_2D_MULTISAMPLE
0034         Target2DMultisampleArray   = 0x9102,    // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
0035         TargetRectangle            = 0x84F5,    // GL_TEXTURE_RECTANGLE
0036         TargetBuffer               = 0x8C2A     // GL_TEXTURE_BUFFER
0037     };
0038     Q_ENUM(Target)
0039 
0040     enum BindingTarget {
0041         BindingTarget1D                    = 0x8068,   // GL_TEXTURE_BINDING_1D
0042         BindingTarget1DArray               = 0x8C1C,   // GL_TEXTURE_BINDING_1D_ARRAY
0043         BindingTarget2D                    = 0x8069,   // GL_TEXTURE_BINDING_2D
0044         BindingTarget2DArray               = 0x8C1D,   // GL_TEXTURE_BINDING_2D_ARRAY
0045         BindingTarget3D                    = 0x806A,   // GL_TEXTURE_BINDING_3D
0046         BindingTargetCubeMap               = 0x8514,   // GL_TEXTURE_BINDING_CUBE_MAP
0047         BindingTargetCubeMapArray          = 0x900A,   // GL_TEXTURE_BINDING_CUBE_MAP_ARRAY
0048         BindingTarget2DMultisample         = 0x9104,   // GL_TEXTURE_BINDING_2D_MULTISAMPLE
0049         BindingTarget2DMultisampleArray    = 0x9105,   // GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
0050         BindingTargetRectangle             = 0x84F6,   // GL_TEXTURE_BINDING_RECTANGLE
0051         BindingTargetBuffer                = 0x8C2C    // GL_TEXTURE_BINDING_BUFFER
0052     };
0053     Q_ENUM(BindingTarget)
0054 
0055     enum MipMapGeneration {
0056         GenerateMipMaps,
0057         DontGenerateMipMaps
0058     };
0059     Q_ENUM(MipMapGeneration)
0060 
0061     enum TextureUnitReset {
0062         ResetTextureUnit,
0063         DontResetTextureUnit
0064     };
0065     Q_ENUM(TextureUnitReset)
0066 
0067     enum TextureFormat {
0068         NoFormat               = 0,         // GL_NONE
0069 
0070         // Unsigned normalized formats
0071         R8_UNorm               = 0x8229,    // GL_R8
0072         RG8_UNorm              = 0x822B,    // GL_RG8
0073         RGB8_UNorm             = 0x8051,    // GL_RGB8
0074         RGBA8_UNorm            = 0x8058,    // GL_RGBA8
0075 
0076         R16_UNorm              = 0x822A,    // GL_R16
0077         RG16_UNorm             = 0x822C,    // GL_RG16
0078         RGB16_UNorm            = 0x8054,    // GL_RGB16
0079         RGBA16_UNorm           = 0x805B,    // GL_RGBA16
0080 
0081         // Signed normalized formats
0082         R8_SNorm               = 0x8F94,    // GL_R8_SNORM
0083         RG8_SNorm              = 0x8F95,    // GL_RG8_SNORM
0084         RGB8_SNorm             = 0x8F96,    // GL_RGB8_SNORM
0085         RGBA8_SNorm            = 0x8F97,    // GL_RGBA8_SNORM
0086 
0087         R16_SNorm              = 0x8F98,    // GL_R16_SNORM
0088         RG16_SNorm             = 0x8F99,    // GL_RG16_SNORM
0089         RGB16_SNorm            = 0x8F9A,    // GL_RGB16_SNORM
0090         RGBA16_SNorm           = 0x8F9B,    // GL_RGBA16_SNORM
0091 
0092         // Unsigned integer formats
0093         R8U                    = 0x8232,    // GL_R8UI
0094         RG8U                   = 0x8238,    // GL_RG8UI
0095         RGB8U                  = 0x8D7D,    // GL_RGB8UI
0096         RGBA8U                 = 0x8D7C,    // GL_RGBA8UI
0097 
0098         R16U                   = 0x8234,    // GL_R16UI
0099         RG16U                  = 0x823A,    // GL_RG16UI
0100         RGB16U                 = 0x8D77,    // GL_RGB16UI
0101         RGBA16U                = 0x8D76,    // GL_RGBA16UI
0102 
0103         R32U                   = 0x8236,    // GL_R32UI
0104         RG32U                  = 0x823C,    // GL_RG32UI
0105         RGB32U                 = 0x8D71,    // GL_RGB32UI
0106         RGBA32U                = 0x8D70,    // GL_RGBA32UI
0107 
0108         // Signed integer formats
0109         R8I                    = 0x8231,    // GL_R8I
0110         RG8I                   = 0x8237,    // GL_RG8I
0111         RGB8I                  = 0x8D8F,    // GL_RGB8I
0112         RGBA8I                 = 0x8D8E,    // GL_RGBA8I
0113 
0114         R16I                   = 0x8233,    // GL_R16I
0115         RG16I                  = 0x8239,    // GL_RG16I
0116         RGB16I                 = 0x8D89,    // GL_RGB16I
0117         RGBA16I                = 0x8D88,    // GL_RGBA16I
0118 
0119         R32I                   = 0x8235,    // GL_R32I
0120         RG32I                  = 0x823B,    // GL_RG32I
0121         RGB32I                 = 0x8D83,    // GL_RGB32I
0122         RGBA32I                = 0x8D82,    // GL_RGBA32I
0123 
0124         // Floating point formats
0125         R16F                   = 0x822D,    // GL_R16F
0126         RG16F                  = 0x822F,    // GL_RG16F
0127         RGB16F                 = 0x881B,    // GL_RGB16F
0128         RGBA16F                = 0x881A,    // GL_RGBA16F
0129 
0130         R32F                   = 0x822E,    // GL_R32F
0131         RG32F                  = 0x8230,    // GL_RG32F
0132         RGB32F                 = 0x8815,    // GL_RGB32F
0133         RGBA32F                = 0x8814,    // GL_RGBA32F
0134 
0135         // Packed formats
0136         RGB9E5                 = 0x8C3D,    // GL_RGB9_E5
0137         RG11B10F               = 0x8C3A,    // GL_R11F_G11F_B10F
0138         RG3B2                  = 0x2A10,    // GL_R3_G3_B2
0139         R5G6B5                 = 0x8D62,    // GL_RGB565
0140         RGB5A1                 = 0x8057,    // GL_RGB5_A1
0141         RGBA4                  = 0x8056,    // GL_RGBA4
0142         RGB10A2                = 0x906F,    // GL_RGB10_A2UI
0143 
0144         // Depth formats
0145         D16                    = 0x81A5,    // GL_DEPTH_COMPONENT16
0146         D24                    = 0x81A6,    // GL_DEPTH_COMPONENT24
0147         D24S8                  = 0x88F0,    // GL_DEPTH24_STENCIL8
0148         D32                    = 0x81A7,    // GL_DEPTH_COMPONENT32
0149         D32F                   = 0x8CAC,    // GL_DEPTH_COMPONENT32F
0150         D32FS8X24              = 0x8CAD,    // GL_DEPTH32F_STENCIL8
0151         S8                     = 0x8D48,    // GL_STENCIL_INDEX8
0152 
0153         // Compressed formats
0154         RGB_DXT1               = 0x83F0,    // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
0155         RGBA_DXT1              = 0x83F1,    // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
0156         RGBA_DXT3              = 0x83F2,    // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
0157         RGBA_DXT5              = 0x83F3,    // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
0158         R_ATI1N_UNorm          = 0x8DBB,    // GL_COMPRESSED_RED_RGTC1
0159         R_ATI1N_SNorm          = 0x8DBC,    // GL_COMPRESSED_SIGNED_RED_RGTC1
0160         RG_ATI2N_UNorm         = 0x8DBD,    // GL_COMPRESSED_RG_RGTC2
0161         RG_ATI2N_SNorm         = 0x8DBE,    // GL_COMPRESSED_SIGNED_RG_RGTC2
0162         RGB_BP_UNSIGNED_FLOAT  = 0x8E8F,    // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
0163         RGB_BP_SIGNED_FLOAT    = 0x8E8E,    // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
0164         RGB_BP_UNorm           = 0x8E8C,    // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
0165         R11_EAC_UNorm          = 0x9270,    // GL_COMPRESSED_R11_EAC
0166         R11_EAC_SNorm          = 0x9271,    // GL_COMPRESSED_SIGNED_R11_EAC
0167         RG11_EAC_UNorm         = 0x9272,    // GL_COMPRESSED_RG11_EAC
0168         RG11_EAC_SNorm         = 0x9273,    // GL_COMPRESSED_SIGNED_RG11_EAC
0169         RGB8_ETC2              = 0x9274,    // GL_COMPRESSED_RGB8_ETC2
0170         SRGB8_ETC2             = 0x9275,    // GL_COMPRESSED_SRGB8_ETC2
0171         RGB8_PunchThrough_Alpha1_ETC2 = 0x9276, // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
0172         SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
0173         RGBA8_ETC2_EAC         = 0x9278,    // GL_COMPRESSED_RGBA8_ETC2_EAC
0174         SRGB8_Alpha8_ETC2_EAC  = 0x9279,    // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
0175         RGB8_ETC1              = 0x8D64,    // GL_ETC1_RGB8_OES
0176         RGBA_ASTC_4x4          = 0x93B0,    // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
0177         RGBA_ASTC_5x4          = 0x93B1,    // GL_COMPRESSED_RGBA_ASTC_5x4_KHR
0178         RGBA_ASTC_5x5          = 0x93B2,    // GL_COMPRESSED_RGBA_ASTC_5x5_KHR
0179         RGBA_ASTC_6x5          = 0x93B3,    // GL_COMPRESSED_RGBA_ASTC_6x5_KHR
0180         RGBA_ASTC_6x6          = 0x93B4,    // GL_COMPRESSED_RGBA_ASTC_6x6_KHR
0181         RGBA_ASTC_8x5          = 0x93B5,    // GL_COMPRESSED_RGBA_ASTC_8x5_KHR
0182         RGBA_ASTC_8x6          = 0x93B6,    // GL_COMPRESSED_RGBA_ASTC_8x6_KHR
0183         RGBA_ASTC_8x8          = 0x93B7,    // GL_COMPRESSED_RGBA_ASTC_8x8_KHR
0184         RGBA_ASTC_10x5         = 0x93B8,    // GL_COMPRESSED_RGBA_ASTC_10x5_KHR
0185         RGBA_ASTC_10x6         = 0x93B9,    // GL_COMPRESSED_RGBA_ASTC_10x6_KHR
0186         RGBA_ASTC_10x8         = 0x93BA,    // GL_COMPRESSED_RGBA_ASTC_10x8_KHR
0187         RGBA_ASTC_10x10        = 0x93BB,    // GL_COMPRESSED_RGBA_ASTC_10x10_KHR
0188         RGBA_ASTC_12x10        = 0x93BC,    // GL_COMPRESSED_RGBA_ASTC_12x10_KHR
0189         RGBA_ASTC_12x12        = 0x93BD,    // GL_COMPRESSED_RGBA_ASTC_12x12_KHR
0190         SRGB8_Alpha8_ASTC_4x4  = 0x93D0,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
0191         SRGB8_Alpha8_ASTC_5x4  = 0x93D1,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
0192         SRGB8_Alpha8_ASTC_5x5  = 0x93D2,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
0193         SRGB8_Alpha8_ASTC_6x5  = 0x93D3,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
0194         SRGB8_Alpha8_ASTC_6x6  = 0x93D4,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
0195         SRGB8_Alpha8_ASTC_8x5  = 0x93D5,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
0196         SRGB8_Alpha8_ASTC_8x6  = 0x93D6,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
0197         SRGB8_Alpha8_ASTC_8x8  = 0x93D7,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
0198         SRGB8_Alpha8_ASTC_10x5 = 0x93D8,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
0199         SRGB8_Alpha8_ASTC_10x6 = 0x93D9,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
0200         SRGB8_Alpha8_ASTC_10x8 = 0x93DA,    // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
0201         SRGB8_Alpha8_ASTC_10x10 = 0x93DB,   // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
0202         SRGB8_Alpha8_ASTC_12x10 = 0x93DC,   // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
0203         SRGB8_Alpha8_ASTC_12x12 = 0x93DD,   // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
0204 
0205         // sRGB formats
0206         SRGB8                  = 0x8C41,    // GL_SRGB8
0207         SRGB8_Alpha8           = 0x8C43,    // GL_SRGB8_ALPHA8
0208         SRGB_DXT1              = 0x8C4C,    // GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
0209         SRGB_Alpha_DXT1        = 0x8C4D,    // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
0210         SRGB_Alpha_DXT3        = 0x8C4E,    // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
0211         SRGB_Alpha_DXT5        = 0x8C4F,    // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
0212         SRGB_BP_UNorm          = 0x8E8D,    // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
0213 
0214         // ES 2 formats
0215         DepthFormat            = 0x1902,    // GL_DEPTH_COMPONENT
0216         AlphaFormat            = 0x1906,    // GL_ALPHA
0217         RGBFormat              = 0x1907,    // GL_RGB
0218         RGBAFormat             = 0x1908,    // GL_RGBA
0219         LuminanceFormat        = 0x1909,    // GL_LUMINANCE
0220         LuminanceAlphaFormat   = 0x190A
0221 
0222     };
0223     Q_ENUM(TextureFormat)
0224 
0225     // This is not used externally yet but is reserved to allow checking of
0226     // compatibility between texture formats
0227 #ifndef Q_QDOC
0228     enum TextureFormatClass {
0229         NoFormatClass,
0230         FormatClass_128Bit,
0231         FormatClass_96Bit,
0232         FormatClass_64Bit,
0233         FormatClass_48Bit,
0234         FormatClass_32Bit,
0235         FormatClass_24Bit,
0236         FormatClass_16Bit,
0237         FormatClass_8Bit,
0238         FormatClass_RGTC1_R,
0239         FormatClass_RGTC2_RG,
0240         FormatClass_BPTC_Unorm,
0241         FormatClass_BPTC_Float,
0242         FormatClass_S3TC_DXT1_RGB,
0243         FormatClass_S3TC_DXT1_RGBA,
0244         FormatClass_S3TC_DXT3_RGBA,
0245         FormatClass_S3TC_DXT5_RGBA,
0246         FormatClass_Unique
0247     };
0248 #endif
0249 
0250     enum CubeMapFace {
0251         CubeMapPositiveX = 0x8515,  // GL_TEXTURE_CUBE_MAP_POSITIVE_X
0252         CubeMapNegativeX = 0x8516,  // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
0253         CubeMapPositiveY = 0x8517,  // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
0254         CubeMapNegativeY = 0x8518,  // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
0255         CubeMapPositiveZ = 0x8519,  // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
0256         CubeMapNegativeZ = 0x851A   // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
0257     };
0258     Q_ENUM(CubeMapFace)
0259 
0260     enum PixelFormat {
0261         NoSourceFormat = 0,         // GL_NONE
0262         Red            = 0x1903,    // GL_RED
0263         RG             = 0x8227,    // GL_RG
0264         RGB            = 0x1907,    // GL_RGB
0265         BGR            = 0x80E0,    // GL_BGR
0266         RGBA           = 0x1908,    // GL_RGBA
0267         BGRA           = 0x80E1,    // GL_BGRA
0268         Red_Integer    = 0x8D94,    // GL_RED_INTEGER
0269         RG_Integer     = 0x8228,    // GL_RG_INTEGER
0270         RGB_Integer    = 0x8D98,    // GL_RGB_INTEGER
0271         BGR_Integer    = 0x8D9A,    // GL_BGR_INTEGER
0272         RGBA_Integer   = 0x8D99,    // GL_RGBA_INTEGER
0273         BGRA_Integer   = 0x8D9B,    // GL_BGRA_INTEGER
0274         Stencil        = 0x1901,    // GL_STENCIL_INDEX
0275         Depth          = 0x1902,    // GL_DEPTH_COMPONENT
0276         DepthStencil   = 0x84F9,    // GL_DEPTH_STENCIL
0277         Alpha          = 0x1906,    // GL_ALPHA
0278         Luminance      = 0x1909,    // GL_LUMINANCE
0279         LuminanceAlpha = 0x190A     // GL_LUMINANCE_ALPHA
0280     };
0281     Q_ENUM(PixelFormat)
0282 
0283     enum PixelType {
0284         NoPixelType        = 0,         // GL_NONE
0285         Int8               = 0x1400,    // GL_BYTE
0286         UInt8              = 0x1401,    // GL_UNSIGNED_BYTE
0287         Int16              = 0x1402,    // GL_SHORT
0288         UInt16             = 0x1403,    // GL_UNSIGNED_SHORT
0289         Int32              = 0x1404,    // GL_INT
0290         UInt32             = 0x1405,    // GL_UNSIGNED_INT
0291         Float16            = 0x140B,    // GL_HALF_FLOAT
0292         Float16OES         = 0x8D61,    // GL_HALF_FLOAT_OES
0293         Float32            = 0x1406,    // GL_FLOAT
0294         UInt32_RGB9_E5     = 0x8C3E,    // GL_UNSIGNED_INT_5_9_9_9_REV
0295         UInt32_RG11B10F    = 0x8C3B,    // GL_UNSIGNED_INT_10F_11F_11F_REV
0296         UInt8_RG3B2        = 0x8032,    // GL_UNSIGNED_BYTE_3_3_2
0297         UInt8_RG3B2_Rev    = 0x8362,    // GL_UNSIGNED_BYTE_2_3_3_REV
0298         UInt16_RGB5A1      = 0x8034,    // GL_UNSIGNED_SHORT_5_5_5_1
0299         UInt16_RGB5A1_Rev  = 0x8366,    // GL_UNSIGNED_SHORT_1_5_5_5_REV
0300         UInt16_R5G6B5      = 0x8363,    // GL_UNSIGNED_SHORT_5_6_5
0301         UInt16_R5G6B5_Rev  = 0x8364,    // GL_UNSIGNED_SHORT_5_6_5_REV
0302         UInt16_RGBA4       = 0x8033,    // GL_UNSIGNED_SHORT_4_4_4_4
0303         UInt16_RGBA4_Rev   = 0x8365,    // GL_UNSIGNED_SHORT_4_4_4_4_REV
0304         UInt32_RGBA8       = 0x8035,    // GL_UNSIGNED_INT_8_8_8_8
0305         UInt32_RGBA8_Rev   = 0x8367,    // GL_UNSIGNED_INT_8_8_8_8_REV
0306         UInt32_RGB10A2     = 0x8036,    // GL_UNSIGNED_INT_10_10_10_2
0307         UInt32_RGB10A2_Rev = 0x8368,    // GL_UNSIGNED_INT_2_10_10_10_REV
0308         UInt32_D24S8       = 0x84FA,    // GL_UNSIGNED_INT_24_8
0309         Float32_D32_UInt32_S8_X24 = 0x8DAD // GL_FLOAT_32_UNSIGNED_INT_24_8_REV
0310     };
0311     Q_ENUM(PixelType)
0312 
0313     enum SwizzleComponent {
0314         SwizzleRed   = 0x8E42,  // GL_TEXTURE_SWIZZLE_R
0315         SwizzleGreen = 0x8E43,  // GL_TEXTURE_SWIZZLE_G
0316         SwizzleBlue  = 0x8E44,  // GL_TEXTURE_SWIZZLE_B
0317         SwizzleAlpha = 0x8E45   // GL_TEXTURE_SWIZZLE_A
0318     };
0319     Q_ENUM(SwizzleComponent)
0320 
0321     enum SwizzleValue {
0322         RedValue   = 0x1903, // GL_RED
0323         GreenValue = 0x1904, // GL_GREEN
0324         BlueValue  = 0x1905, // GL_BLUE
0325         AlphaValue = 0x1906, // GL_ALPHA
0326         ZeroValue  = 0,      // GL_ZERO
0327         OneValue   = 1       // GL_ONE
0328     };
0329     Q_ENUM(SwizzleValue)
0330 
0331     enum WrapMode {
0332         Repeat         = 0x2901, // GL_REPEAT
0333         MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
0334         ClampToEdge    = 0x812F, // GL_CLAMP_TO_EDGE
0335         ClampToBorder  = 0x812D  // GL_CLAMP_TO_BORDER
0336     };
0337     Q_ENUM(WrapMode)
0338 
0339     enum CoordinateDirection {
0340         DirectionS = 0x2802, // GL_TEXTURE_WRAP_S
0341         DirectionT = 0x2803, // GL_TEXTURE_WRAP_T
0342         DirectionR = 0x8072  // GL_TEXTURE_WRAP_R
0343     };
0344     Q_ENUM(CoordinateDirection)
0345 
0346     // Features
0347     enum Feature {
0348         ImmutableStorage            = 0x00000001,
0349         ImmutableMultisampleStorage = 0x00000002,
0350         TextureRectangle            = 0x00000004,
0351         TextureArrays               = 0x00000008,
0352         Texture3D                   = 0x00000010,
0353         TextureMultisample          = 0x00000020,
0354         TextureBuffer               = 0x00000040,
0355         TextureCubeMapArrays        = 0x00000080,
0356         Swizzle                     = 0x00000100,
0357         StencilTexturing            = 0x00000200,
0358         AnisotropicFiltering        = 0x00000400,
0359         NPOTTextures                = 0x00000800,
0360         NPOTTextureRepeat           = 0x00001000,
0361         Texture1D                   = 0x00002000,
0362         TextureComparisonOperators  = 0x00004000,
0363         TextureMipMapLevel          = 0x00008000,
0364 #ifndef Q_QDOC
0365         MaxFeatureFlag              = 0x00010000
0366 #endif
0367     };
0368     Q_DECLARE_FLAGS(Features, Feature)
0369     Q_ENUM(Feature)
0370 
0371     explicit QOpenGLTexture(Target target);
0372     explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
0373     ~QOpenGLTexture();
0374 
0375     Target target() const;
0376 
0377     // Creation and destruction
0378     bool create();
0379     void destroy();
0380     bool isCreated() const;
0381     GLuint textureId() const;
0382 
0383     // Binding and releasing
0384     void bind();
0385     void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
0386     void release();
0387     void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
0388 
0389     bool isBound() const;
0390     bool isBound(uint unit);
0391     static GLuint boundTextureId(BindingTarget target);
0392     static GLuint boundTextureId(uint unit, BindingTarget target);
0393 
0394     // Storage allocation
0395     void setFormat(TextureFormat format);
0396     TextureFormat format() const;
0397     void setSize(int width, int height = 1, int depth = 1);
0398     int width() const;
0399     int height() const;
0400     int depth() const;
0401     void setMipLevels(int levels);
0402     int mipLevels() const;
0403     int maximumMipLevels() const;
0404     void setLayers(int layers);
0405     int layers() const;
0406     int faces() const;
0407     void setSamples(int samples);
0408     int samples() const;
0409     void setFixedSamplePositions(bool fixed);
0410     bool isFixedSamplePositions() const;
0411     void allocateStorage();
0412     void allocateStorage(PixelFormat pixelFormat, PixelType pixelType);
0413     bool isStorageAllocated() const;
0414 
0415     QOpenGLTexture *createTextureView(Target target,
0416                                       TextureFormat viewFormat,
0417                                       int minimumMipmapLevel, int maximumMipmapLevel,
0418                                       int minimumLayer, int maximumLayer) const;
0419     bool isTextureView() const;
0420 
0421     // Pixel transfer
0422     void setData(int mipLevel, int layer, CubeMapFace cubeFace,
0423                  PixelFormat sourceFormat, PixelType sourceType,
0424                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0425     void setData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
0426                  PixelFormat sourceFormat, PixelType sourceType,
0427                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0428     void setData(int mipLevel, int layer,
0429                  PixelFormat sourceFormat, PixelType sourceType,
0430                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0431     void setData(int mipLevel,
0432                  PixelFormat sourceFormat, PixelType sourceType,
0433                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0434     void setData(PixelFormat sourceFormat, PixelType sourceType,
0435                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0436 
0437     void setData(int xOffset, int yOffset, int zOffset,
0438                  int width, int height, int depth,
0439                  PixelFormat sourceFormat, PixelType sourceType,
0440                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0441     void setData(int xOffset, int yOffset, int zOffset,
0442                  int width, int height, int depth, int mipLevel,
0443                  PixelFormat sourceFormat, PixelType sourceType,
0444                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0445     void setData(int xOffset, int yOffset, int zOffset,
0446                  int width, int height, int depth,
0447                  int mipLevel, int layer,
0448                  PixelFormat sourceFormat, PixelType sourceType,
0449                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0450     void setData(int xOffset, int yOffset, int zOffset,
0451                  int width, int height, int depth,
0452                  int mipLevel, int layer,
0453                  CubeMapFace cubeFace,
0454                  PixelFormat sourceFormat, PixelType sourceType,
0455                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0456     void setData(int xOffset, int yOffset, int zOffset,
0457                  int width, int height, int depth,
0458                  int mipLevel, int layer,
0459                  CubeMapFace cubeFace, int layerCount,
0460                  PixelFormat sourceFormat, PixelType sourceType,
0461                  const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
0462 
0463     // Compressed data upload
0464     void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
0465                            int dataSize, const void *data,
0466                            const QOpenGLPixelTransferOptions * const options = nullptr);
0467     void setCompressedData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
0468                            int dataSize, const void *data,
0469                            const QOpenGLPixelTransferOptions * const options = nullptr);
0470     void setCompressedData(int mipLevel, int layer,
0471                            int dataSize, const void *data,
0472                            const QOpenGLPixelTransferOptions * const options = nullptr);
0473     void setCompressedData(int mipLevel, int dataSize, const void *data,
0474                            const QOpenGLPixelTransferOptions * const options = nullptr);
0475     void setCompressedData(int dataSize, const void *data,
0476                            const QOpenGLPixelTransferOptions * const options = nullptr);
0477 
0478     // Helpful overloads for setData
0479     void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
0480 
0481     static bool hasFeature(Feature feature);
0482 
0483     // Texture Parameters
0484     void setMipBaseLevel(int baseLevel);
0485     int mipBaseLevel() const;
0486     void setMipMaxLevel(int maxLevel);
0487     int mipMaxLevel() const;
0488     void setMipLevelRange(int baseLevel, int maxLevel);
0489     QPair<int, int> mipLevelRange() const;
0490 
0491     void setAutoMipMapGenerationEnabled(bool enabled);
0492     bool isAutoMipMapGenerationEnabled() const;
0493 
0494     void generateMipMaps();
0495     void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
0496 
0497     void setSwizzleMask(SwizzleComponent component, SwizzleValue value);
0498     void setSwizzleMask(SwizzleValue r, SwizzleValue g,
0499                         SwizzleValue b, SwizzleValue a);
0500     SwizzleValue swizzleMask(SwizzleComponent component) const;
0501 
0502     enum DepthStencilMode {
0503         DepthMode   = 0x1902,   // GL_DEPTH_COMPONENT
0504         StencilMode = 0x1901    // GL_STENCIL_INDEX
0505     };
0506     Q_ENUM(DepthStencilMode)
0507 
0508     void setDepthStencilMode(DepthStencilMode mode);
0509     DepthStencilMode depthStencilMode() const;
0510 
0511     enum ComparisonFunction {
0512         CompareLessEqual    = 0x0203,   // GL_LEQUAL
0513         CompareGreaterEqual = 0x0206,   // GL_GEQUAL
0514         CompareLess         = 0x0201,   // GL_LESS
0515         CompareGreater      = 0x0204,   // GL_GREATER
0516         CompareEqual        = 0x0202,   // GL_EQUAL
0517         CompareNotEqual     = 0x0205,   // GL_NOTEQUAL
0518         CompareAlways       = 0x0207,   // GL_ALWAYS
0519         CompareNever        = 0x0200,   // GL_NEVER
0520 
0521 #if QT_DEPRECATED_SINCE(6, 1)
0522         CommpareNotEqual Q_DECL_ENUMERATOR_DEPRECATED_X(
0523             "Use CompareNotEqual instead.") = CompareNotEqual
0524 #endif
0525     };
0526     Q_ENUM(ComparisonFunction)
0527 
0528     void setComparisonFunction(ComparisonFunction function);
0529     ComparisonFunction comparisonFunction() const;
0530 
0531     enum ComparisonMode {
0532         CompareRefToTexture = 0x884E,   // GL_COMPARE_REF_TO_TEXTURE
0533         CompareNone         = 0x0000    // GL_NONE
0534     };
0535 
0536     void setComparisonMode(ComparisonMode mode);
0537     ComparisonMode comparisonMode() const;
0538 
0539     // Sampling Parameters
0540     enum Filter {
0541         Nearest                 = 0x2600,   // GL_NEAREST
0542         Linear                  = 0x2601,   // GL_LINEAR
0543         NearestMipMapNearest    = 0x2700,   // GL_NEAREST_MIPMAP_NEAREST
0544         NearestMipMapLinear     = 0x2702,   // GL_NEAREST_MIPMAP_LINEAR
0545         LinearMipMapNearest     = 0x2701,   // GL_LINEAR_MIPMAP_NEAREST
0546         LinearMipMapLinear      = 0x2703    // GL_LINEAR_MIPMAP_LINEAR
0547     };
0548     Q_ENUM(Filter)
0549 
0550     void setMinificationFilter(Filter filter);
0551     Filter minificationFilter() const;
0552     void setMagnificationFilter(Filter filter);
0553     Filter magnificationFilter() const;
0554     void setMinMagFilters(Filter minificationFilter,
0555                           Filter magnificationFilter);
0556     QPair<Filter, Filter> minMagFilters() const;
0557     void setMaximumAnisotropy(float anisotropy);
0558     float maximumAnisotropy() const;
0559 
0560     void setWrapMode(WrapMode mode);
0561     void setWrapMode(CoordinateDirection direction, WrapMode mode);
0562     WrapMode wrapMode(CoordinateDirection direction) const;
0563 
0564     void setBorderColor(const QColor &color);
0565     void setBorderColor(float r, float g, float b, float a);
0566     void setBorderColor(int r, int g, int b, int a);
0567     void setBorderColor(uint r, uint g, uint b, uint a);
0568 
0569     QColor borderColor() const;
0570     void borderColor(float *border) const;
0571     void borderColor(int *border) const;
0572     void borderColor(unsigned int *border) const;
0573 
0574     void setMinimumLevelOfDetail(float value);
0575     float minimumLevelOfDetail() const;
0576     void setMaximumLevelOfDetail(float value);
0577     float maximumLevelOfDetail() const;
0578     void setLevelOfDetailRange(float min, float max);
0579     QPair<float, float> levelOfDetailRange() const;
0580     void setLevelofDetailBias(float bias);
0581     float levelofDetailBias() const;
0582 
0583 #ifndef QT_NO_DEBUG_STREAM
0584     friend Q_OPENGL_EXPORT QDebug operator<<(QDebug dbg, const QOpenGLTexture *t);
0585 #endif
0586 
0587 private:
0588     Q_DISABLE_COPY(QOpenGLTexture)
0589     Q_DECLARE_PRIVATE(QOpenGLTexture)
0590     QScopedPointer<QOpenGLTexturePrivate> d_ptr;
0591 };
0592 
0593 Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTexture::Features)
0594 
0595 #ifndef QT_NO_DEBUG_STREAM
0596 Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLTexture *t);
0597 #endif
0598 
0599 QT_END_NAMESPACE
0600 
0601 #endif // QT_NO_OPENGL
0602 
0603 #endif // QOPENGLABSTRACTTEXTURE_H