OpenGL: Add finer-grained functionality checks for NPOT textures
authorSean Harmer <sean.harmer.qnx@kdab.com>
Mon, 6 Aug 2012 09:55:53 +0000 (10:55 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 6 Aug 2012 14:04:43 +0000 (16:04 +0200)
The GL_IMG_texture_npot extension only provides partial support for
npot textures in that it allows use of npot textures but it does not
support the GL_REPEAT texture mode (needed for tiling fill modes in the
QQ2 image element).

Adding this new finer-grained feature check allows QQ2 to still use npot
textures where GL_REPEAT is not needed with only the IMG extension
present.

A follow-up commit will make a check for this in qtdeclarative.

Change-Id: Iff3dbdb955fb334d9e32f3abd49e90ff0ed9836c
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/gui/opengl/qopenglfunctions.cpp
src/gui/opengl/qopenglfunctions.h

index a5fcbd1..b2728ab 100644 (file)
@@ -265,10 +265,11 @@ static int qt_gl_resolve_features()
                    QOpenGLFunctions::Multisample |
                    QOpenGLFunctions::StencilSeparate;
     QOpenGLExtensionMatcher extensions;
-    if (extensions.match("GL_OES_texture_npot"))
-        features |= QOpenGLFunctions::NPOTTextures;
     if (extensions.match("GL_IMG_texture_npot"))
         features |= QOpenGLFunctions::NPOTTextures;
+    if (extensions.match("GL_OES_texture_npot"))
+        features |= QOpenGLFunctions::NPOTTextures |
+                    QOpenGLFunctions::NPOTTextureRepeat;
     return features;
 #elif defined(QT_OPENGL_ES)
     int features = QOpenGLFunctions::Multitexture |
index fc55a6b..9657679 100644 (file)
@@ -217,7 +217,8 @@ public:
         CompressedTextures    = 0x0200,
         Multisample           = 0x0400,
         StencilSeparate       = 0x0800,
-        NPOTTextures          = 0x1000
+        NPOTTextures          = 0x1000,
+        NPOTTextureRepeat     = 0x2000
     };
     Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)