progs/demos: added RGB invert option
This commit is contained in:
@@ -26,6 +26,7 @@ static int Scissor = 0;
|
|||||||
static float Xzoom, Yzoom;
|
static float Xzoom, Yzoom;
|
||||||
static GLboolean DrawFront = GL_FALSE;
|
static GLboolean DrawFront = GL_FALSE;
|
||||||
static GLboolean Dither = GL_TRUE;
|
static GLboolean Dither = GL_TRUE;
|
||||||
|
static GLboolean Invert = GL_FALSE;
|
||||||
|
|
||||||
|
|
||||||
static void Reset( void )
|
static void Reset( void )
|
||||||
@@ -59,6 +60,15 @@ static void Display( void )
|
|||||||
if (Scissor)
|
if (Scissor)
|
||||||
glEnable(GL_SCISSOR_TEST);
|
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 */
|
/* draw copy */
|
||||||
glPixelZoom(Xzoom, Yzoom);
|
glPixelZoom(Xzoom, Yzoom);
|
||||||
glWindowPos2iARB(Xpos, Ypos);
|
glWindowPos2iARB(Xpos, Ypos);
|
||||||
@@ -67,6 +77,15 @@ static void Display( void )
|
|||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
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)
|
if (DrawFront)
|
||||||
glFinish();
|
glFinish();
|
||||||
else
|
else
|
||||||
@@ -105,6 +124,9 @@ static void Key( unsigned char key, int x, int y )
|
|||||||
else
|
else
|
||||||
glDisable(GL_DITHER);
|
glDisable(GL_DITHER);
|
||||||
break;
|
break;
|
||||||
|
case 'i':
|
||||||
|
Invert = !Invert;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
Scissor = !Scissor;
|
Scissor = !Scissor;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user