![]() |
|Download Files|
![]() ![]() ![]() ![]() ![]() Next: 2.4 Basic GL Operation Up: 2 OpenGL Operation Previous: 2.2 GL State
2.3 GL Command SyntaxGL commands are functions or procedures. Various groups of commands perform the same operation but differ in how arguments are supplied to them. To conveniently accommodate this variation, we adopt a notation for describing commands and their arguments. GL commands are formed from a name followed, depending on the particular command, by up to 4 characters. The first character indicates the number of values of the indicated type that must be presented to the command. The second character or character pair indicates the specific type of the arguments: 8-bit integer, 16-bit integer, 32-bit integer, single-precision floating-point, or double-precision floating-point. The final character, if present, is v, indicating that the command takes a pointer to an array (a vector) of values rather than a series of individual arguments. Two specific examples come from the Vertex command:
void Vertex3f ( float x, float y, float z ) ; and
void Vertex2sv ( short v[2] ) ; These examples show the ANSI C declarations for these commands. In general,
a command declaration has the form
rtype Name{
rtype is the return type of the function.
The braces ({}) enclose a series of characters (or
character pairs) of which one is selected.
For example, indicates the two declarations
void Normal3f ( float arg1, float arg2, float arg3 ) ; while means the two declarations
void Normal3fv ( float arg[3] ) ;
Arguments whose type is fixed (i.e. not indicated by a suffix on the command) are of one of 14 types (or pointers to one of these). These types are summarized in Table 2.2.
![]() ![]() ![]() ![]() ![]() Next: 2.4 Basic GL Operation Up: 2 OpenGL Operation Previous: 2.2 GL State
David Blythe Sat Mar 29 02:23:21 PST 1997
|