<<< noperspective example | Index | GLSL Geometric functions >>> |
GLSL provides numerous mathematical functions for scalars, vectors, and matrices:
log( ) // natural log exp( ) // exponent log2( ) // log base 2 exp2( ) // 2 to the power of... sqrt( )
For example,
vec2 results = pow( vec2( 2, 3 ), vec2( 2, 2 ) ); // 2^2, 3^2 float x = sin( 1.0 ); // Also cos, tan, atan, asin... float z = radians( 45.0f ); // Converts from degrees to radians float z = degrees( 0.6f ); // Converts from radians to degrees
<<< noperspective example | Index | GLSL Geometric functions >>> |