Game Development Reference
In-Depth Information
Reserved Variables
The main important reserved variable names within the OpenGL ES 2.0 shader language that we will
be using in this topic are specified in the following list.
vec4 gl_Position: Reserved variable within the vertex shader that holds the final
transformed vertex to be displayed on the screen
vec4 gl_FragColor: Reserved variable within the fragment shader that holds the
color of the vertex that has just been processed by the vertex shader
Built-in Functions
This list provides some of the important built-in functions in the shading language.
float radians(float degrees): Converts degrees to radians and returns radians
float degrees(float radians): Converts radians to degrees and returns degrees
float sin(float angle): Returns the sine of an angle measured in radians
float cos(float angle): Returns the cosine of an angle measured in radians
float tan(float angle): Returns the tangent of an angle measured in radians
float asin(float x): Returns the angle whose sine is x
float acos(float x): Returns the angle whose cosine is x
float atan(float y, float x): Returns the angle whose tangent is specified by the
slope y/x
float atan(float slope): Returns the angle whose tangent is slope
float abs(float x): Returns the absolute value of x
float length(vec3 x): Returns the length of vector x
float distance(vec3 point0, vec3 point1): Returns the distance between point0
and point1
float dot(vec3 x, vec3 y): Returns the dot product between two vectors x and y
vec3 cross(vec3 x, vec3 y): Returns the cross product of two vectors x and y
vec3 normalize(vec3 x): Normalizes the vector to a length of 1 and then returns it
float pow(float x, float y): Calculates x to the power of y and return it
float min(float x, float y): Returns the minimum value between x and y
float max(float x, float y): Returns the maximum value between x and y
 
Search WWH ::




Custom Search