Back to project page FxCameraApp.
The source code is released under:
MIT License
If you think the Android project FxCameraApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.af.experiments.FxCameraApp.shaders; /*from w ww . j a v a2s. co m*/ public class GlGrayScaleShader extends GlShader { protected String mShaderName = "BW"; @Override public String getName() { return mShaderName; } private static final String FRAGMENT_SHADER = "precision mediump float;" + "varying vec2 vTextureCoord;" + "uniform lowp sampler2D sTexture;" + "const highp vec3 weight = vec3(0.2125, 0.7154, 0.0721);" + "void main() {" + "float luminance = dot(texture2D(sTexture, vTextureCoord).rgb, weight);" + "gl_FragColor = vec4(vec3(luminance), 1.0);" + "}"; public GlGrayScaleShader() { super(DEFAULT_VERTEX_SHADER, FRAGMENT_SHADER); } }