-
-
Save kazukitanaka0611/5616997 to your computer and use it in GitHub Desktop.
This is Filter for https://github.com/kazukitanaka0611/GLCameraTemplate
This file contains hidden or 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
#pragma mark - | |
- (NSString *)getFragmentShaderString | |
{ | |
NSString *const kFragmentShaderString = SHADER_STRING | |
( | |
varying highp vec2 textureCoordinate; | |
uniform sampler2D inputImageTexture; | |
const highp vec3 W = vec3(0.2125, 0.7154, 0.0721); | |
void main() | |
{ | |
// To gray | |
highp float gray = step(0.5,dot(texture2D(inputImageTexture, textureCoordinate).rgb, W)); | |
lowp vec4 colorToDisplay = vec4(1.0, 1.0, 1.0, 1.0); | |
if (gray < 1.00) | |
{ | |
colorToDisplay = vec4(1.0, 0.0, 0.0, 1.0); | |
} | |
gl_FragColor = colorToDisplay; | |
} | |
); | |
return kFragmentShaderString; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment