i want to make gray scale filter on runtime i succeed to make it by this code
NSString *const kGPUImageLuminanceFragmentShaderString = SHADER_STRING
(
precision highp float;
varying vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);
void main()
{
float luminance = dot(texture2D(inputImageTexture, textureCoordinate).rgb, W);
gl_FragColor = vec4(vec3(luminance), 1.0);
}
);
what i want now is to access the rgb values of each point and apply on it my algorithm then change the point rgb values based on my algorithm
my question in other word
i want to access the rgb values of a point and set the rgb values of the same point
OR this to maintain the alpha of the original pixel: