You didn't really choose highp everywhere; from the GLSL ES spec chapter 8 (Built-in Functions):
Precision qualifiers for parameters and return values are not shown. For the texture functions, the precision of the return type matches the precision of the sampler type.
and from 4.5.3 (Default Precision Qualifiers):
The fragment language has the following predeclared globally scoped default precision statements: ...
precision lowp sampler2D;
...
Which means that in your code texture2D (uColorTexture, vTexCoord)
will return a lowp
, you are adding two of them, potentially resulting in a value of 2.0.
From 4.5.2 (Precision Qualifiers):
The required minimum ranges and precisions for precision qualifiers are: ... lowp (−2,2) ...
The parentheses in (-2,2)
indicate an open range, meaning it includes values up to (but not including) 2.
So I think the fact that you're adding two lowp
's together means you're overflowing. Try changing that line to:
tmp = texture2D(uColorTexture, vTexCoord)/2.0 + texture2D(uColorTexture, vTexCoord)/2.0;