From e4d15b41e83d552c64f32541570f9009a6c6ec81 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 14 Jan 2015 00:02:38 +0100 Subject: QOpenGLTexture: introduce texture comparison support Shadow sampling is an old OpenGL feature (hello, OpenGL 1.3!), which was missing from QOpenGLTexture. This commit adds the relevant support. Change-Id: I9f6b552d806a356d24ee08121af6bc9ce684f2b5 Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/gui/opengl/qopengltexture.h') diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 1cf5fdc12aa..56fdd07f2f5 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -346,8 +346,9 @@ public: NPOTTextures = 0x00000800, NPOTTextureRepeat = 0x00001000, Texture1D = 0x00002000, + TextureComparisonOperators = 0x00004000, #ifndef Q_QDOC - MaxFeatureFlag = 0x00004000 + MaxFeatureFlag = 0x00008000 #endif }; Q_DECLARE_FLAGS(Features, Feature) @@ -488,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 -- cgit v1.2.3