I am going through the Book of Shaders tutorial on GLSL and I attempt to use the smoothstep function but I get this error. You can see it happen when I changed the step to the smoothstep function below.
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec3 color = vec3(0.0);
// bottom-left
vec2 bl = smoothstep(vec2(0.1),st);
float pct = bl.x * bl.y;
// top-right
// vec2 tr = step(vec2(0.1),1.0-st);
// pct *= tr.x * tr.y;
color = vec3(pct);
gl_FragColor = vec4(color,1.0);
}
Any ideas how to fix this?
stepandsmootstepare 2 functions with a different signature and behavior. Whilestepgenerates a hard transition from 0 to 1 at an edge,smoothstepsmoothly interpolates between 2 values.As specified in the Khronos reference,
smoothstephas 3 parameters:edge0Specifies the value of the lower edge of the Hermite function.edge1Specifies the value of the upper edge of the Hermite function.xSpecifies the source value for interpolation.In comparison,
stephas 2 parameters:edgeSpecifies the location of the edge of the step function.xSpecify the value to be used to generate the step function.