Skip to content

Commit

Permalink
Fix dithering for OpenGL ES2.
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Apr 10, 2018
1 parent 8a187d5 commit 9c0cae2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/Dithering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ inline Vec3f calcRGBMaxValue(StelPainter::DitheringMode mode)
inline QString makeDitheringShader()
{
return
R"(uniform vec3 rgbMaxValue;
R"(uniform mediump vec3 rgbMaxValue;
uniform sampler2D bayerPattern;
vec3 dither(vec3 c)
mediump vec3 dither(mediump vec3 c)
{
if(rgbMaxValue.r==0.) return c;
float bayer=texture2D(bayerPattern,gl_FragCoord.xy/8.).r;
mediump float bayer=texture2D(bayerPattern,gl_FragCoord.xy/8.).r;
vec3 rgb=c*rgbMaxValue;
vec3 head=floor(rgb);
vec3 tail=fract(rgb);
mediump vec3 rgb=c*rgbMaxValue;
mediump vec3 head=floor(rgb);
mediump vec3 tail=fract(rgb);
return (head+step(bayer,tail))/rgbMaxValue;
}
vec4 dither(vec4 c) { return vec4(dither(c.xyz),c.w); }
mediump vec4 dither(mediump vec4 c) { return vec4(dither(c.xyz),c.w); }
)";
}

Expand Down

0 comments on commit 9c0cae2

Please sign in to comment.