GLSL built-in function

all()

Returns true only when every component is true.

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

Syntax

bool all(bvec2 x)
bool all(bvec3 x)
bool all(bvec4 x)

Parameters

x
Input value or left-hand vector

Return value

One bool: true if every component of x is true, otherwise false.

Live example

Edit the code and the preview updates as you type.

What all does

Returns true only when every component is true.

Read the preview

The orange square is where both tests in lessThan(abs(vec2(x,y)),vec2(0.5)) are true. Set the limit to vec2(0.25) to halve its width and height.

Core call

float(all(lessThan(abs(vec2(x,y)),vec2(0.5))));

A point inside a rectangle must satisfy both coordinate tests.

Experiment

Use vec2(0.75,0.25) instead of vec2(0.5) inside lessThan. The all-test now paints a wide, short rectangle because each axis has its own bound.

Specification

GLSL ES 1.00 built-in functions, chapter 8

Related functions