Created
May 12, 2015 07:13
-
-
Save quadpixels/62a621bd7124125ab4f2 to your computer and use it in GitHub Desktop.
Compton Custom Shader Case 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform float opacity; | |
uniform bool invert_color; | |
uniform sampler2D tex; | |
void main() { | |
vec4 c = texture2D(tex, gl_TexCoord[0]); | |
float eps = 0.004f; | |
float eps1 = 1.0f / 255.0f; | |
if (invert_color) | |
c = vec4(vec3(c.a, c.a, c.a) - vec3(c), c.a); | |
// Some Greybird Background Colors: 0xF4F4F4 (Menu bk), 0xFEFEFE (Textbox bk), 0xCECECE (Grey bk) | |
if((c.r > 0.807+eps1-eps && c.r < 0.807+eps1+eps && | |
c.g > 0.807+eps1-eps && c.g < 0.807+eps1+eps && | |
c.b > 0.807+eps1-eps && c.b < 0.807+eps1+eps) || | |
(c.r > 0.953+eps1-eps && c.r < 0.953+eps1+eps && | |
c.g > 0.953+eps1-eps && c.g < 0.953+eps1+eps && | |
c.b > 0.953+eps1-eps && c.b < 0.953+eps1+eps) || | |
(c.r > 0.988+eps1-eps && c.r < 0.988+eps1+eps && | |
c.g > 0.988+eps1-eps && c.g < 0.988+eps1+eps && | |
c.b > 0.988+eps1-eps && c.b < 0.988+eps1+eps) | |
) | |
{ c *= opacity; } | |
else { } | |
gl_FragColor = c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment