GLSL built-in function
notEqual()
Marks components that differ between two vectors.
Demo version: GLSL ES 1.00 / WebGL 1Demo stage: Fragment
Syntax
bvec2 notEqual(vec2 x, vec2 y)
bvec3 notEqual(vec3 x, vec3 y)
bvec4 notEqual(vec4 x, vec4 y)
bvec2 notEqual(ivec2 x, ivec2 y)
bvec3 notEqual(ivec3 x, ivec3 y)
bvec4 notEqual(ivec4 x, ivec4 y)
bvec2 notEqual(bvec2 x, bvec2 y)
bvec3 notEqual(bvec3 x, bvec3 y)
bvec4 notEqual(bvec4 x, bvec4 y)Parameters
- x
- Input value or left-hand vector
- y
- Right-hand vector or comparison value
Return value
A boolean vector whose components are true when the matching components of x and y differ.
Live example
Edit the code and the preview updates as you type.
What notEqual does
Marks components that differ between two vectors.
Read the preview
The floor(x*4.0) strip equal to zero is the only false band. Compare with ivec2(-1) instead to move that gap into x in [-0.25, 0).
Core call
float(notEqual(ivec2(int(floor(x*4.0)),0),ivec2(0)).x);
The result is a boolean vector, not a single bool.
Experiment
Switch the selected component after notEqual from .x to .y. Both original y components are zero, so their inequality test is false over the entire image.