Created
March 27, 2018 22:06
-
-
Save omarojo/37d8c884c26de52300656c1b00e21171 to your computer and use it in GitHub Desktop.
Black and White Shader (GPUImage)
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
precision highp float; | |
varying highp vec2 textureCoordinate; | |
uniform sampler2D inputImageTexture; | |
void main() | |
{ | |
highp vec4 textureColor; | |
highp vec4 rCol; | |
highp vec4 gCol; | |
highp vec4 bCol; | |
highp vec4 outputColor; | |
textureColor = texture2D(inputImageTexture, textureCoordinate); | |
rCol = vec4(vec3(textureColor.r), 1.0); | |
textureColor = texture2D(inputImageTexture, textureCoordinate); | |
gCol = vec4(vec3(textureColor.g), 1.0); | |
textureColor = texture2D(inputImageTexture, textureCoordinate); | |
bCol = vec4(vec3(textureColor.b), 1.0); | |
float avgColorVal = (rCol.r+gCol.g+bCol.b)/3.0; | |
gl_FragColor = vec4(vec3(avgColorVal,avgColorVal,avgColorVal),1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment