Get rid of legacy glTexParameterf calls.
authorSamuel Rødal <samuel.rodal@nokia.com>
Fri, 21 Oct 2011 10:37:18 +0000 (12:37 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 24 Oct 2011 09:22:09 +0000 (11:22 +0200)
ES 1.0 didn't have glTexParameteri, which is why we sometimes used
glTexParameterf. However, we shouldn't use glTexParameterf because
that's treating integer values as floating point, which is not type
safe. ES 1.1+ and ES 2.x have glTexParameteri, and we don't really care
about supporting ES 1.0 in any case in Qt 5.

Change-Id: I12247e4ffc8cb0e18b0ffca5759d4655b5432008
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/scenegraph/qsgdefaultglyphnode_p.cpp
src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp
src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp

index e34a4e0..649c543 100644 (file)
@@ -137,8 +137,8 @@ void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial
         // Set the mag/min filters to be linear. We only need to do this when the texture
         // has been recreated.
         if (updated) {
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
         }
     }
 
index ec69a64..22aced9 100644 (file)
@@ -1055,10 +1055,10 @@ void QSGDistanceFieldGlyphCache::createTexture(int width, int height)
     glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
 
     glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
     m_textureData->size = QSize(width, height);
 
@@ -1101,10 +1101,10 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
     glBindTexture(GL_TEXTURE_2D, tmp_texture);
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
                  GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     glBindTexture(GL_TEXTURE_2D, 0);
     ctx->functions()->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                              GL_TEXTURE_2D, tmp_texture, 0);
index 1e8b668..a7dbb3b 100644 (file)
@@ -179,10 +179,10 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q
         if (updated) {
             // Set the mag/min filters to be linear. We only need to do this when the texture
             // has been recreated.
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
         }
     }
 }