summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-15 09:15:02 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-15 09:15:02 +0100
commit5bac584538c7f7c72a41521a440df5e8a6358753 (patch)
treeba9d835f2430091612c982d8fab9f9efb9955a9e
parent763319ec1e787a12733ae138dee295aabd327882 (diff)
downloadcv-5bac584538c7f7c72a41521a440df5e8a6358753.tar.gz
cv-5bac584538c7f7c72a41521a440df5e8a6358753.tar.bz2
cv-5bac584538c7f7c72a41521a440df5e8a6358753.zip
wimmel.frag: Rename search_rect to srect
-rw-r--r--wimmel.frag13
-rw-r--r--wimmel_gl.c2
2 files changed, 7 insertions, 8 deletions
diff --git a/wimmel.frag b/wimmel.frag
index d3cf745..b148852 100644
--- a/wimmel.frag
+++ b/wimmel.frag
@@ -1,20 +1,19 @@
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform vec2 pixelsize;
-uniform vec4 search_rect;
+/* The rect to match against */
+uniform vec4 srect;
uniform int barrier;
void
main()
{
- float i, j;
- float width = search_rect[2];
- float height = search_rect[3];
int diff = 0;
+ float i, j;
- for (i = 0.0; i < width && diff < barrier; i += pixelsize.x) {
- for (j = 0.0; j < height && diff < barrier; j += pixelsize.y) {
- vec4 match = texture2D(tex, search_rect.xy + vec2(i,j));
+ for (i = 0.0; i < srect[2] && diff < barrier; i += pixelsize.x) {
+ for (j = 0.0; j < srect[3] && diff < barrier; j += pixelsize.y) {
+ vec4 match = texture2D(tex, srect.xy + vec2(i,j));
vec4 orig = texture2D(tex, v_texcoord + vec2(i,j));
diff += int(any(greaterThan(abs(orig - match), vec4(0.2))));
diff --git a/wimmel_gl.c b/wimmel_gl.c
index dcf4c19..0432823 100644
--- a/wimmel_gl.c
+++ b/wimmel_gl.c
@@ -79,7 +79,7 @@ init_shaders()
proj_uniform = glGetUniformLocation(program, "proj");
tex_uniform = glGetUniformLocation(program, "tex");
pixelsize_uniform = glGetUniformLocation(program, "pixelsize");
- search_rect_uniform = glGetUniformLocation(program, "search_rect");
+ search_rect_uniform = glGetUniformLocation(program, "srect");
barrier_uniform = glGetUniformLocation(program, "barrier");
vertices[ 0] = 0.0;