summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltexture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/opengl/qopengltexture.h')
-rw-r--r--src/gui/opengl/qopengltexture.h234
1 files changed, 134 insertions, 100 deletions
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index a0b23c211c..56fdd07f2f 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -88,29 +88,6 @@ public:
DontResetTextureUnit
};
- explicit QOpenGLTexture(Target target);
- explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
- ~QOpenGLTexture();
-
- Target target() const;
-
- // Creation and destruction
- bool create();
- void destroy();
- bool isCreated() const;
- GLuint textureId() const;
-
- // Binding and releasing
- void bind();
- void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
- void release();
- void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
-
- bool isBound() const;
- bool isBound(uint unit);
- static GLuint boundTextureId(BindingTarget target);
- static GLuint boundTextureId(uint unit, BindingTarget target);
-
enum TextureFormat {
NoFormat = 0, // GL_NONE
@@ -209,6 +186,16 @@ public:
RGB_BP_UNSIGNED_FLOAT = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
RGB_BP_SIGNED_FLOAT = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
RGB_BP_UNorm = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
+ R11_EAC_UNorm = 0x9270, // GL_COMPRESSED_R11_EAC
+ R11_EAC_SNorm = 0x9271, // GL_COMPRESSED_SIGNED_R11_EAC
+ RG11_EAC_UNorm = 0x9272, // GL_COMPRESSED_RG11_EAC
+ RG11_EAC_SNorm = 0x9273, // GL_COMPRESSED_SIGNED_RG11_EAC
+ RGB8_ETC2 = 0x9274, // GL_COMPRESSED_RGB8_ETC2
+ SRGB8_ETC2 = 0x9275, // GL_COMPRESSED_SRGB8_ETC2
+ RGB8_PunchThrough_Alpha1_ETC2 = 0x9276, // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
+ SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
+ RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC
+ SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
// sRGB formats
SRGB8 = 0x8C41, // GL_SRGB8
@@ -254,32 +241,6 @@ public:
};
#endif
- // Storage allocation
- void setFormat(TextureFormat format);
- TextureFormat format() const;
- void setSize(int width, int height = 1, int depth = 1);
- int width() const;
- int height() const;
- int depth() const;
- void setMipLevels(int levels);
- int mipLevels() const;
- int maximumMipLevels() const;
- void setLayers(int layers);
- int layers() const;
- int faces() const;
- void setSamples(int samples);
- int samples() const;
- void setFixedSamplePositions(bool fixed);
- bool isFixedSamplePositions() const;
- void allocateStorage();
- bool isStorageAllocated() const;
-
- QOpenGLTexture *createTextureView(Target target,
- TextureFormat viewFormat,
- int minimumMipmapLevel, int maximumMipmapLevel,
- int minimumLayer, int maximumLayer) const;
- bool isTextureView() const;
-
enum CubeMapFace {
CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
@@ -340,6 +301,108 @@ public:
Float32_D32_UInt32_S8_X24 = 0x8DAD // GL_FLOAT_32_UNSIGNED_INT_24_8_REV
};
+ enum SwizzleComponent {
+ SwizzleRed = 0x8E42, // GL_TEXTURE_SWIZZLE_R
+ SwizzleGreen = 0x8E43, // GL_TEXTURE_SWIZZLE_G
+ SwizzleBlue = 0x8E44, // GL_TEXTURE_SWIZZLE_B
+ SwizzleAlpha = 0x8E45 // GL_TEXTURE_SWIZZLE_A
+ };
+
+ enum SwizzleValue {
+ RedValue = 0x1903, // GL_RED
+ GreenValue = 0x1904, // GL_GREEN
+ BlueValue = 0x1905, // GL_BLUE
+ AlphaValue = 0x1906, // GL_ALPHA
+ ZeroValue = 0, // GL_ZERO
+ OneValue = 1 // GL_ONE
+ };
+
+ enum WrapMode {
+ Repeat = 0x2901, // GL_REPEAT
+ MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
+ ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
+ ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
+ };
+
+ enum CoordinateDirection {
+ DirectionS = 0x2802, // GL_TEXTURE_WRAP_S
+ DirectionT = 0x2803, // GL_TEXTURE_WRAP_T
+ DirectionR = 0x8072 // GL_TEXTURE_WRAP_R
+ };
+
+ // Features
+ enum Feature {
+ ImmutableStorage = 0x00000001,
+ ImmutableMultisampleStorage = 0x00000002,
+ TextureRectangle = 0x00000004,
+ TextureArrays = 0x00000008,
+ Texture3D = 0x00000010,
+ TextureMultisample = 0x00000020,
+ TextureBuffer = 0x00000040,
+ TextureCubeMapArrays = 0x00000080,
+ Swizzle = 0x00000100,
+ StencilTexturing = 0x00000200,
+ AnisotropicFiltering = 0x00000400,
+ NPOTTextures = 0x00000800,
+ NPOTTextureRepeat = 0x00001000,
+ Texture1D = 0x00002000,
+ TextureComparisonOperators = 0x00004000,
+#ifndef Q_QDOC
+ MaxFeatureFlag = 0x00008000
+#endif
+ };
+ Q_DECLARE_FLAGS(Features, Feature)
+
+ explicit QOpenGLTexture(Target target);
+ explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
+ ~QOpenGLTexture();
+
+ Target target() const;
+
+ // Creation and destruction
+ bool create();
+ void destroy();
+ bool isCreated() const;
+ GLuint textureId() const;
+
+ // Binding and releasing
+ void bind();
+ void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
+ void release();
+ void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
+
+ bool isBound() const;
+ bool isBound(uint unit);
+ static GLuint boundTextureId(BindingTarget target);
+ static GLuint boundTextureId(uint unit, BindingTarget target);
+
+ // Storage allocation
+ void setFormat(TextureFormat format);
+ TextureFormat format() const;
+ void setSize(int width, int height = 1, int depth = 1);
+ int width() const;
+ int height() const;
+ int depth() const;
+ void setMipLevels(int levels);
+ int mipLevels() const;
+ int maximumMipLevels() const;
+ void setLayers(int layers);
+ int layers() const;
+ int faces() const;
+ void setSamples(int samples);
+ int samples() const;
+ void setFixedSamplePositions(bool fixed);
+ bool isFixedSamplePositions() const;
+ void allocateStorage();
+ void allocateStorage(PixelFormat pixelFormat, PixelType pixelType);
+ bool isStorageAllocated() const;
+
+ QOpenGLTexture *createTextureView(Target target,
+ TextureFormat viewFormat,
+ int minimumMipmapLevel, int maximumMipmapLevel,
+ int minimumLayer, int maximumLayer) const;
+ bool isTextureView() const;
+
// Pixel transfer
// ### Qt 6: remove the non-const void * overloads
#if QT_DEPRECATED_SINCE(5, 3)
@@ -397,28 +460,6 @@ public:
// Helpful overloads for setData
void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
- // Features
- enum Feature {
- ImmutableStorage = 0x00000001,
- ImmutableMultisampleStorage = 0x00000002,
- TextureRectangle = 0x00000004,
- TextureArrays = 0x00000008,
- Texture3D = 0x00000010,
- TextureMultisample = 0x00000020,
- TextureBuffer = 0x00000040,
- TextureCubeMapArrays = 0x00000080,
- Swizzle = 0x00000100,
- StencilTexturing = 0x00000200,
- AnisotropicFiltering = 0x00000400,
- NPOTTextures = 0x00000800,
- NPOTTextureRepeat = 0x00001000,
- Texture1D = 0x00002000,
-#ifndef Q_QDOC
- MaxFeatureFlag = 0x00004000
-#endif
- };
- Q_DECLARE_FLAGS(Features, Feature)
-
static bool hasFeature(Feature feature);
// Texture Parameters
@@ -435,22 +476,6 @@ public:
void generateMipMaps();
void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
- enum SwizzleComponent {
- SwizzleRed = 0x8E42, // GL_TEXTURE_SWIZZLE_R
- SwizzleGreen = 0x8E43, // GL_TEXTURE_SWIZZLE_G
- SwizzleBlue = 0x8E44, // GL_TEXTURE_SWIZZLE_B
- SwizzleAlpha = 0x8E45 // GL_TEXTURE_SWIZZLE_A
- };
-
- enum SwizzleValue {
- RedValue = 0x1903, // GL_RED
- GreenValue = 0x1904, // GL_GREEN
- BlueValue = 0x1905, // GL_BLUE
- AlphaValue = 0x1906, // GL_ALPHA
- ZeroValue = 0, // GL_ZERO
- OneValue = 1 // GL_ONE
- };
-
void setSwizzleMask(SwizzleComponent component, SwizzleValue value);
void setSwizzleMask(SwizzleValue r, SwizzleValue g,
SwizzleValue b, SwizzleValue a);
@@ -464,6 +489,28 @@ public:
void setDepthStencilMode(DepthStencilMode mode);
DepthStencilMode depthStencilMode() const;
+ enum ComparisonFunction {
+ CompareLessEqual = 0x0203, // GL_LEQUAL
+ CompareGreaterEqual = 0x0206, // GL_GEQUAL
+ CompareLess = 0x0201, // GL_LESS
+ CompareGreater = 0x0204, // GL_GREATER
+ CompareEqual = 0x0202, // GL_EQUAL
+ CommpareNotEqual = 0x0205, // GL_NOTEQUAL
+ CompareAlways = 0x0207, // GL_ALWAYS
+ CompareNever = 0x0200 // GL_NEVER
+ };
+
+ void setComparisonFunction(ComparisonFunction function);
+ ComparisonFunction comparisonFunction() const;
+
+ enum ComparisonMode {
+ CompareRefToTexture = 0x884E, // GL_COMPARE_REF_TO_TEXTURE
+ CompareNone = 0x0000 // GL_NONE
+ };
+
+ void setComparisonMode(ComparisonMode mode);
+ ComparisonMode comparisonMode() const;
+
// Sampling Parameters
enum Filter {
Nearest = 0x2600, // GL_NEAREST
@@ -484,19 +531,6 @@ public:
void setMaximumAnisotropy(float anisotropy);
float maximumAnisotropy() const;
- enum WrapMode {
- Repeat = 0x2901, // GL_REPEAT
- MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
- ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
- ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
- };
-
- enum CoordinateDirection {
- DirectionS = 0x2802, // GL_TEXTURE_WRAP_S
- DirectionT = 0x2803, // GL_TEXTURE_WRAP_T
- DirectionR = 0x8072 // GL_TEXTURE_WRAP_R
- };
-
void setWrapMode(WrapMode mode);
void setWrapMode(CoordinateDirection direction, WrapMode mode);
WrapMode wrapMode(CoordinateDirection direction) const;