JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
Previous Page
Next Page

5.6. Vector Relational Functions

Relational and equality operators (<, <=, >, >=, ==, !=) are defined to produce scalar Boolean results and can be used within either vertex shaders or fragment shaders. For vector results, use the built-in functions in Table 5.6.

Table 5.6. Vector relational functions

Syntax

Description

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

Returns the component-wise compare of x < y.

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

Returns the component-wise compare of x <= y.

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

Returns the component-wise compare of x > y.

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)

Returns the component-wise compare of x >= y.

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

Returns the component-wise compare of x == y.

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)

Returns the component-wise compare of x != y.

bool any(bvec2 x)
bool any(bvec3 x)
bool any(bvec4 x)

Returns true if any component of x is true.

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

Returns true only if all components of x are true.

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

Returns the component-wise logical complement of x.



Previous Page
Next Page




JavaScript EditorAjax Editor     JavaScript Editor