OpenGL ES Command Syntax
All OpenGL ES commands begin with the prefix gl and use an initial capital letter for each word making up the command name (e.g., glBlendEquation). Similarly, OpenGL ES data types also begin with the prefix GL.
In addition, some commands might take arguments in different flavors. The flavors or types vary in terms of the number of arguments taken (one to four arguments), the data type of the arguments used (byte [b], unsigned byte [ub], short [s], unsigned short [us], int [i], and float [f]), and whether the arguments are passed as a vector (v). A few examples of command flavors allowed in OpenGL ES follow.
The following two commands are equivalent except that one specifies the uniform value as floats and the other as integers:
glUniform2f(location, l.Of, O.Of); glUniform2i(location, 1, 0)
The following lines describe commands that are also equivalent, except that one passes command arguments as a vector and the other does not:
GLfloat coord[4] = { l.Of, 0.75f, 0.25f, O.Of }; glUniform4fv(location, coord); glUniform4f(location, coord[0], coord[l], coord[2], coord[3]);
Table 1-2 describes the command suffixes and argument data types used in OpenGL ES.
Table 1-2 OpenGL ES Command Suffixes and Argument Data Types
Suffix |
Data Type |
C-Language Type |
GL Type |
b |
8-bit signed integer |
signed char |
GLbyte |
ub |
8-bit unsigned integer |
unsigned char |
GLubyte, GLboolean |
s |
16-bit signed integer |
short |
GLshort |
us |
16-bit unsigned integer |
unsigned short |
GLushort |
i |
32-bit signed integer |
int |
GLint |
ui |
32-bit unsigned integer |
unsigned int |
GLuint, GLbitfield, GLenum |
x |
16.16 fixed point |
int |
GLfixed |
f |
32-bit floating point |
float |
GLfloat, GLclampf |
i64 |
64-bit integer |
khronos_int64_t (platform dependent) |
GLint64 |
ui64 |
64-bit unsigned integer |
khronos_uint64_t (platform dependent) |
GLuint64 |
Finally, OpenGL ES defines the type GLvoid. This type is used for OpenGL ES commands that accept pointers.
In the rest of this book, OpenGL ES commands are referred to by their base names only, and an asterisk is used to indicate that this base name refers to multiple flavors of the command name. For example, glUniform*() stands for all variations of the command you use to specify uniforms and glUniform*v() refers to all the vector versions of the command you use to specify uniforms. If a particular version of a command needs to be discussed, we use the full command name with the appropriate suffixes.