Skip to content

Commit

Permalink
Saturation filter working with alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
ultramiraculous committed Mar 9, 2012
1 parent 29772f1 commit 34f301d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions framework/Source/GPUImageSaturationFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@

void main()
{
lowp vec3 textureColor = texture2D(inputImageTexture, textureCoordinate).rgb;
lowp float luminance = dot(textureColor, luminanceWeighting);
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
lowp vec3 greyScaleColor = vec3(luminance);

gl_FragColor = vec4(mix(greyScaleColor, textureColor, saturation), 1.0);
gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);

}
);

Expand Down

0 comments on commit 34f301d

Please sign in to comment.