summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/pattern_brush.glsl
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-24 11:34:15 (GMT)
committeraxis <qt-info@nokia.com>2009-04-24 11:34:15 (GMT)
commit8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch)
treea17e1a767a89542ab59907462206d7dcf2e504b2 /src/opengl/util/pattern_brush.glsl
downloadQt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip
Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz
Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2
Long live Qt for S60!
Diffstat (limited to 'src/opengl/util/pattern_brush.glsl')
-rw-r--r--src/opengl/util/pattern_brush.glsl25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/opengl/util/pattern_brush.glsl b/src/opengl/util/pattern_brush.glsl
new file mode 100644
index 0000000..e070449
--- /dev/null
+++ b/src/opengl/util/pattern_brush.glsl
@@ -0,0 +1,25 @@
+uniform sampler2D brush_texture;
+uniform vec2 inv_brush_texture_size;
+uniform vec3 inv_matrix_m0;
+uniform vec3 inv_matrix_m1;
+uniform vec3 inv_matrix_m2;
+
+vec4 brush()
+{
+ mat3 mat;
+
+ mat[0] = inv_matrix_m0;
+ mat[1] = inv_matrix_m1;
+ mat[2] = inv_matrix_m2;
+
+ vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1);
+ vec2 coords = hcoords.xy / hcoords.z;
+
+ coords *= inv_brush_texture_size;
+
+ coords.y = -coords.y;
+
+ float alpha = texture2D(brush_texture, coords).r;
+
+ return gl_Color * alpha;
+}