GLSL built-in function

not()

Negates every component of a boolean vector.

Demo version: GLSL ES 1.00 / WebGL 1Demo stage: Fragment

Syntax

bvec2 not(bvec2 x)
bvec3 not(bvec3 x)
bvec4 not(bvec4 x)

Parameters

x
Input value or left-hand vector

Return value

A boolean vector of the same size, with each true changed to false and each false changed to true.

Live example

Edit the code and the preview updates as you type.

What not does

Negates every component of a boolean vector.

Read the preview

not(lessThan(vec2(x,y),vec2(0.0))).x reverses the left-half test into a right-half test. Set the lessThan bound to vec2(0.5) to move the inversion boundary right.

Core call

float(not(lessThan(vec2(x,y),vec2(0.0))).x);

Use ! for scalar logical negation; not accepts a boolean vector.

Experiment

Replace the input to not with bvec2(true,false) and keep .x. The selected first component becomes false everywhere; choosing .y instead makes it true everywhere.

Specification

GLSL ES 1.00 built-in functions, chapter 8

Related functions