summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadersource_p.h
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-09-14 09:00:01 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-09-14 09:06:26 (GMT)
commit9d075f383597f727b0c5c1e6bdbb9646e35c0fa0 (patch)
tree4a4e8d47d8ad5dc46622f568b7a66f6e63c32e84 /src/opengl/gl2paintengineex/qglengineshadersource_p.h
parent5e54649a29f65f32beb2c310fd2a81d60b901537 (diff)
downloadQt-9d075f383597f727b0c5c1e6bdbb9646e35c0fa0.zip
Qt-9d075f383597f727b0c5c1e6bdbb9646e35c0fa0.tar.gz
Qt-9d075f383597f727b0c5c1e6bdbb9646e35c0fa0.tar.bz2
Fix drawTiledPixmap for NPOT pixmaps on OpenGL ES 2.0
OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead, we emulate GL_REPEAT by only taking the fractional part of the texture coords in the fragment shader. Task-number: 260982 Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadersource_p.h')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index acd4461..6bcf010 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -260,12 +260,24 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\
static const char* const qglslAffinePositionWithTextureBrushVertexShader
= qglslPositionWithTextureBrushVertexShader;
+#if defined(QT_OPENGL_ES_2)
+// OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead,
+// we emulate GL_REPEAT by only taking the fractional part of the texture coords.
+// TODO: Special case POT textures which don't need this emulation
+static const char* const qglslTextureBrushSrcFragmentShader = "\
+ varying highp vec2 brushTextureCoords; \
+ uniform lowp sampler2D brushTexture; \
+ lowp vec4 srcPixel() { \
+ return texture2D(brushTexture, fract(brushTextureCoords)); \
+ }";
+#else
static const char* const qglslTextureBrushSrcFragmentShader = "\
varying highp vec2 brushTextureCoords; \
uniform lowp sampler2D brushTexture; \
lowp vec4 srcPixel() { \
return texture2D(brushTexture, brushTextureCoords); \
}";
+#endif
static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\
varying highp vec2 brushTextureCoords; \