summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2008-01-23 20:01:47 +0100
committerDennis Kasprzyk <onestone@opencompositing.org>2008-01-23 20:01:47 +0100
commitf93c97cca95f9957e2e84cccc35a7eacf7b73aa9 (patch)
tree64aa49412eac5d4ba182a73cb8714648c20da1a3
parent87a564f616211ad2bbf41f708d33ce33a82801e2 (diff)
downloadmag-f93c97cca95f9957e2e84cccc35a7eacf7b73aa9.tar.gz
mag-f93c97cca95f9957e2e84cccc35a7eacf7b73aa9.tar.bz2
Replace "fragment.position" with texture coordinates to workaround broken implementations.
-rw-r--r--mag.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/mag.c b/mag.c
index b3b3c67..3d5824e 100644
--- a/mag.c
+++ b/mag.c
@@ -105,7 +105,7 @@ static const char *fisheyeFpString =
"TEMP t0, t1, t2, t3;"
- "SUB t1, p0.xyww, fragment.position;"
+ "SUB t1, p0.xyww, fragment.texcoord[0];"
"DP3 t2, t1, t1;"
"RSQ t2, t2.x;"
"SUB t0, t2, p0;"
@@ -117,9 +117,9 @@ static const char *fisheyeFpString =
"MUL t3, t3, p1.w;"
"MUL t1, t2, t1;"
- "MAD t1, t1, t3, fragment.position;"
+ "MAD t1, t1, t3, fragment.texcoord[0];"
- "CMP t1, t0.z, fragment.position, t1;"
+ "CMP t1, t0.z, fragment.texcoord[0], t1;"
"MAD t1, t1, p1, p2;"
"TEX result.color, t1, texture[0], %s;"
@@ -859,10 +859,17 @@ magPaintFisheye (CompScreen *s)
vc[2] = ((y1 * -2.0) / s->height) + 1.0;
vc[3] = ((y2 * -2.0) / s->height) + 1.0;
+ y1 = s->height - y1;
+ y2 = s->height - y2;
+
glBegin (GL_QUADS);
+ glTexCoord2f (x1, y1);
glVertex2f (vc[0], vc[2]);
+ glTexCoord2f (x1, y2);
glVertex2f (vc[0], vc[3]);
+ glTexCoord2f (x2, y2);
glVertex2f (vc[1], vc[3]);
+ glTexCoord2f (x2, y1);
glVertex2f (vc[1], vc[2]);
glEnd ();