step函数
step(edge,x):当x>edge时返回1,否则返回0
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy;
float f = step(0.5, st.x);
gl_FragColor = vec4(f, 0, 0, 1.0);
}
类似下面的javaScript代码
float myStep(float edge, float x){
if(x>= edge){
return 1.0;
}else{
return 0.0;
}
}