我无法编译以下片段着色器:
uniform vec3 color;
uniform sampler2D tDiffuse;
varying vec2 vUv;
void main() {
vec4 texel = texture2D( tDiffuse, vUv );
vec3 luma = vec3( 0.299, 0.587, 0.114 );
float v = dot( texel.xyz, luma );
if (texel.x > 5)
gl_FragColor = vec4( v * color, texel.w );
else
gl_FragColor = texel;
}
如果我将 (texel.x > 5) 更改为 (1 > 5) 它工作正常。但不知何故 texel.x 会导致编译错误。有没有人看到这段代码有明显的问题?