summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/texture_brush.glsl
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:34:13 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:34:13 (GMT)
commit67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch)
tree1dbf50b3dff8d5ca7e9344733968c72704eb15ff /src/opengl/util/texture_brush.glsl
downloadQt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2
Long live Qt!
Diffstat (limited to 'src/opengl/util/texture_brush.glsl')
-rw-r--r--src/opengl/util/texture_brush.glsl23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/opengl/util/texture_brush.glsl b/src/opengl/util/texture_brush.glsl
new file mode 100644
index 0000000..93865b8
--- /dev/null
+++ b/src/opengl/util/texture_brush.glsl
@@ -0,0 +1,23 @@
+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;
+
+ return texture2D(brush_texture, coords);
+}