OpenGL Display list
describing an object as a named sequence of statements (or any other set of commands) is convenient and efficient to store. This can be done using a structure called display list in OpenGL. Once the display table is established, you can refer to the table multiple times with different display operations. in the grid, the display table describing the graph is stored in the server to avoid having to route the commands in the table each time the scene is displayed. We can build and store the display table for future executions, or the commands in the specified table execute immediately. Display tables are especially useful for hierarchical modeling, because a complex object can be described with a simple set of objects.
Creating and naming OpenGL display tables
Use the Glnewlist/glendlist function to surround a set of OpenGL commands to form a display table. For example:
Glnewlist (ListID, Listmode); Glendlist ();
The structure is given with parameters
ListIDA positive integer as the table name to form a display table. Parameter Listmode can be assigned to OpenGL symbol constants
Gl_compileOr
Gl_compile_and_executeOne. If you want to store the table for later execution, use the
Gl_compile。 Otherwise, the command in the release table executes immediately, but it can still be executed later.
When the table is created, the representation of the parameters, such as coordinate locations and color components, is evaluated immediately, so that only the values of the parameters are stored in the table. Any subsequent modifications to these parameters do not work. Because the values of the displayed table cannot be modified, OpenGL commands such as vertex table pointers cannot be included in the display table.
We can create as many display tables as possible and execute a particular display table by invoking an identity. A display table can also be nested within another display table. However, if a display table is given an already used identity, it replaces the original display table content. Therefore, in order to avoid the loss of the display table by reusing the identity for some reason, you can have OpenGL generate an identity:
ListID = glgenlists (1);
The statement assigns an unused positive integer identifier to the variable Listid. If the variable in g1genlists is changed from 1 to another positive integer, an unused display table identification segment is obtained. For example, if you refer to G1genlists (6), 6 consecutive positive integers are preserved and the first of them is assigned to a variable
ListID。 Returns 0 if there is an error or the system cannot produce the number of consecutive integers. Therefore, check whether it is 0 before using the identity obtained from the G1genlists subroutine.
Although using g1genlist can generate unused identities, we can also query the system individually to specify whether an integer value has been used as a table name. The function that implements this function is
Glislist (ListID);
If the return value is Gl_true, the value in Listid is already used as the name of a display table. If the integer is not already in use, the Gtislist function returns the value
Gl_false。
Computer Graphics (ii) OUTPUT elements _18_ display list _1_ creating and naming OpenGL display tables