GLSL built-in function

greaterThanEqual()

Component-wise greater-than-or-equal comparison.

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

Syntax

bvec2 greaterThanEqual(vec2 x, vec2 y)
bvec3 greaterThanEqual(vec3 x, vec3 y)
bvec4 greaterThanEqual(vec4 x, vec4 y)
bvec2 greaterThanEqual(ivec2 x, ivec2 y)
bvec3 greaterThanEqual(ivec3 x, ivec3 y)
bvec4 greaterThanEqual(ivec4 x, ivec4 y)

Parameters

x
Input value or left-hand vector
y
Right-hand vector or comparison value

Return value

A boolean vector with true wherever x is greater than or equal to y, component by component.

Live example

Edit the code and the preview updates as you type.

What greaterThanEqual does

Component-wise greater-than-or-equal comparison.

Read the preview

greaterThanEqual(vec2(x,y),vec2(0.0)).x includes x = 0 in the right-hand region. Changing the bound to vec2(-0.5) extends that region toward the left.

Core call

float(greaterThanEqual(vec2(x,y),vec2(0.0)).x);

The difference from greaterThan occurs at equality.

Experiment

Replace the first vector with vec2(0.0) while keeping the second at vec2(0.0). Equality makes the selected result true across the canvas; a strict greaterThan call would instead be false.

Specification

GLSL ES 1.00 built-in functions, chapter 8

Related functions