summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-09-14 11:22:05 +0200
committerMichal Krol <michal@vmware.com>2009-09-14 11:22:05 +0200
commit9f273f109875cd9208d4c1c8f5939fb5e507c230 (patch)
tree35c8adedcf44cf8eb3bddbb51b5efa766539a07b /progs
parentfab99092a0879531442d1dd20f971ae7eda824eb (diff)
parentaad0deee4b2d347bdfc536fe98938ed825bf0f6b (diff)
Merge commit 'origin/master' into glsl-pp-rework-2
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/copypix.c22
-rw-r--r--progs/fp/add-sat.txt6
-rw-r--r--progs/fp/mov-alias.txt6
-rw-r--r--progs/fp/mul-alias.txt6
-rw-r--r--progs/tests/zreaddraw.c12
5 files changed, 52 insertions, 0 deletions
diff --git a/progs/demos/copypix.c b/progs/demos/copypix.c
index 51435acfa0..a13339ea62 100644
--- a/progs/demos/copypix.c
+++ b/progs/demos/copypix.c
@@ -26,6 +26,7 @@ static int Scissor = 0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
static GLboolean Dither = GL_TRUE;
+static GLboolean Invert = GL_FALSE;
static void Reset( void )
@@ -59,6 +60,15 @@ static void Display( void )
if (Scissor)
glEnable(GL_SCISSOR_TEST);
+ if (Invert) {
+ glPixelTransferf(GL_RED_SCALE, -1.0);
+ glPixelTransferf(GL_GREEN_SCALE, -1.0);
+ glPixelTransferf(GL_BLUE_SCALE, -1.0);
+ glPixelTransferf(GL_RED_BIAS, 1.0);
+ glPixelTransferf(GL_GREEN_BIAS, 1.0);
+ glPixelTransferf(GL_BLUE_BIAS, 1.0);
+ }
+
/* draw copy */
glPixelZoom(Xzoom, Yzoom);
glWindowPos2iARB(Xpos, Ypos);
@@ -67,6 +77,15 @@ static void Display( void )
glDisable(GL_SCISSOR_TEST);
+ if (Invert) {
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
+ glPixelTransferf(GL_RED_BIAS, 0.0);
+ glPixelTransferf(GL_GREEN_BIAS, 0.0);
+ glPixelTransferf(GL_BLUE_BIAS, 0.0);
+ }
+
if (DrawFront)
glFinish();
else
@@ -105,6 +124,9 @@ static void Key( unsigned char key, int x, int y )
else
glDisable(GL_DITHER);
break;
+ case 'i':
+ Invert = !Invert;
+ break;
case 's':
Scissor = !Scissor;
break;
diff --git a/progs/fp/add-sat.txt b/progs/fp/add-sat.txt
new file mode 100644
index 0000000000..2253efb085
--- /dev/null
+++ b/progs/fp/add-sat.txt
@@ -0,0 +1,6 @@
+!!ARBfp1.0
+TEMP R0;
+MOV R0, fragment.color;
+ADD_SAT R0, R0, R0;
+MUL result.color, {0.5}.x, R0;
+END
diff --git a/progs/fp/mov-alias.txt b/progs/fp/mov-alias.txt
new file mode 100644
index 0000000000..5f04e9c76e
--- /dev/null
+++ b/progs/fp/mov-alias.txt
@@ -0,0 +1,6 @@
+!!ARBfp1.0
+TEMP R0;
+MOV R0, fragment.color;
+MOV R0, R0.zyxw;
+MOV result.color, R0;
+END
diff --git a/progs/fp/mul-alias.txt b/progs/fp/mul-alias.txt
new file mode 100644
index 0000000000..cf7d359e78
--- /dev/null
+++ b/progs/fp/mul-alias.txt
@@ -0,0 +1,6 @@
+!!ARBfp1.0
+TEMP R0;
+MOV R0, fragment.color;
+MUL R0, R0.zyxw, fragment.color;
+MOV result.color, R0;
+END
diff --git a/progs/tests/zreaddraw.c b/progs/tests/zreaddraw.c
index 8839e10836..0821d5fb35 100644
--- a/progs/tests/zreaddraw.c
+++ b/progs/tests/zreaddraw.c
@@ -12,6 +12,7 @@
#include <GL/glut.h>
static GLint WinWidth = 500, WinHeight = 500;
+static GLboolean Invert = GL_FALSE;
static void Display(void)
@@ -50,7 +51,15 @@ static void Display(void)
glPixelZoom(4.0, 4.0);
glColor4f(1, 0, 0, 0);
glWindowPos2i(100, 0);
+ if (Invert) {
+ glPixelTransferf(GL_DEPTH_SCALE, -1.0);
+ glPixelTransferf(GL_DEPTH_BIAS, 1.0);
+ }
glDrawPixels(100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth);
+ if (Invert) {
+ glPixelTransferf(GL_DEPTH_SCALE, 1.0);
+ glPixelTransferf(GL_DEPTH_BIAS, 0.0);
+ }
glDisable(GL_DEPTH_TEST);
@@ -77,6 +86,9 @@ static void Key(unsigned char key, int x, int y)
(void) x;
(void) y;
switch (key) {
+ case 'i':
+ Invert = !Invert;
+ break;
case 27:
exit(0);
break;