summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-09-08 16:45:07 -0600
committerBrian Paul <brianp@vmware.com>2009-09-08 16:45:07 -0600
commit079ae4c38cf8155f7aa039f6f4374fe5d351ef4f (patch)
tree711c8193c5574ec45e62ebf86b515a1181fd14cb /progs
parent126696caf7c2ab66420ab60a2c363613b88bacb4 (diff)
progs/demos: added RGB invert option
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/copypix.c22
1 files changed, 22 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;