Computer Graphics (ii) OUTPUT elements _18_ display list _2_ performing OpenGL display table

Source: Internet
Author: User

executing the OpenGL display tableuse the following statement to perform a display table:
Glcalllist (ListID);
The following program segment is used to create and execute a display table. We first establish a display table of the rule hexagon on the XY plane that describes the six equidistant vertices on a circle with a center coordinate of (200,200) and a radius of 150. However, call Glcalllist to display the hexagon.
Const double TWO_PI = 6.2831853; Gluint Reghex; Gldouble Theta; Glint x, y, K; /* Set up a display list for a regular hexagon.  * Vertices for the hexagon is six equally spaced  * points around the circumference of a circle.  */Reghex = glgenlists (1); Get an identifier for the display list. Glnewlist (Reghex, gl_compile);    Glbegin (Gl_polygon);      for (k = 0; k < 6; k++) {         theta = Two_pi * k/6.0;         x = + + * cos (theta);         y = + * sin (theta);         Glvertex2i (x, y);   } Glend (); Glendlist (); Glcalllist (Reghex);
You can perform multiple display tables using the following two statements:
Gllistbase (Offsetvalue); Glcalllists (nlists, Arraydatatype, Listidarray);
The number of display tables to execute is assigned to the parameter nlists, and the parameter ListidarrayIsdisplays an array of table identities。Generally, Listidarray can contain any number of elements, while invalid identities are ignored。 Similarly, elements in Listidarray can be specified in a variety of data formats, while parameters Arraydatatypeused to indicate data typesFor examplegl_byte,gl_int,gl_float, gl_3_bytes or gl_4_ BYTES. The display table identifies the ListidarrayThe value of one element in the OffsetvalueInteger values are added together. OffsetvalueThe default value is 0.
This mechanism of specifying a list of displayed tables allows us to create a set of related display tables whose identities are formed by symbolic names or encodings。 A typical example is a set of fonts, where each display table identifies an ASCII value of one character. When defining several fonts, use the gllistbase functionIn the OffsetvaiueTo get the array ListidarraySpecific fonts described in the.

Computer Graphics (ii) OUTPUT elements _18_ display list _2_ performing OpenGL display table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.