OpenGL es1.1.12 Chapter 2 2.6 2.6.1

Source: Internet
Author: User

(Draft only, not sorted)

2.6 Basic Elements and vertices

In Gl, geometric objects are drawn through a series of coordinate groups, including vertices, optional normal (optionally normals), and texture coordinates. Coordinate groups are defined by vertex arrays (see section 2.8 ). There are seven types of geometric objects completed in the following ways: Point (including point angle), connection line segment (Line Band), line segment ring, separated line segment, triangle band, triangle fan, separated triangle.

Each vertex is defined by two, three, or four coordinates. In addition, current normal, multiple current texturecoordinate sets, and current color may be used to process vertices.

Normals is used in GL light computing. Current normals is a three-dimensional vector defined by three coordinates. Texture coordinate determines how a texture image is mapped to a basic element. Multiple sets of texture coordinate may be used to define how multi-texture images are mapped to basic elements. The number of texture units depends on the implementation platform, but at least two texture units are required. This number can be obtained by querying max_texture_units.

The color is associated with each vertex. The color is determined by the current color or light. Depending on the light, it depends on whether the light function is enabled. Texture coordinate is also associated with each vertex. Multiple sets of texture coordinate may also be associated with each vertex. Figure 2.2 shows the association between secondary data and the processed vertex generated by the transformed vertex.

The current value is part of the GL status. Vertices. normals and texture coordinates are conversion values. The color may be affected or replaced by the light. The processing process indicates that the current value is used to send each vertex to GL.

The subsequent sections will discuss the methods for sending vertices, normals, texture coordinates, colors to GL, and how normals converts and maps vertices to two-dimensional screens.

When a color is assigned to a vertex, the State required by the vertex is its coordinates, normals, current object attributes (see section 2.12.2), and multi-texture coordinate groups. This is because coloring is a vertex and a vertex operation. Process a vertex, including vertex coordinates, coloring, and multi-texture coordinate groups.

Figure 2.3 shows how to create an element (point, line, or triangle) from a set of vertices. Once an element is created, it is flipped (clipped) into viewing volume. In this case, elements, such as vertex coordinates, texture coordinates, and color, may be changed. In online and triangular situations, a new vertex is inserted to the basic element during the flip (CLIP) process. The raster elements defined by vertices are associated with texture coordinates and colors.

2.6.1 basic element type

A set of vertices are sent to GL through drawarrays or drawelements (see section 2.8. The number of vertices is mainly determined by the size of vertex vectors.

The mode parameter in the Command determines the type of the element to be drawn. The related modes and types are as follows:

Points, a series of independent points may be defined as points. Each vertex is defined as a separation point or vertex.

A linestring. One or more external links are defined as the line_strip mode. At least two vertex coordinates are required. In this case, the first vertex represents the start point of the first part, and the second vertex represents the end point of the first part and the start point of the second part. That is, vertex I (I> 1) represents the start of part I and the end of the I-1. The last vertex indicates the end point of the last part. If there is only one vertex, no element is created.


Figure 2.2 create a processed vertex from the vertex vector coordinate and current value. Only two texture units are displayed, but more texture units are supported, depending on the implementation platform.

Figure 2.3 encapsulate and process elements.


Figure 2.4 a triangle belt, B triangle fan, and C independent triangle. The numerical order given by a vertex is based on the numerical order in the vertex vector. Note that the edge sequence of A and B is determined by the first triangle. In C, the triangle edges are independent of each other.

The State must include the vertex processed by the previously passed vertex (in this way, the line segment can be created from it to the current vertex) and a Boolean identifier, this ID indicates whether the current vertex is the first vertex.

Line_loop. The ring is similar to the line band, but the last part of the ring is that the last vertex is added to the first vertex.

The required State includes the first vertex to be processed, and the other State is the same as that of the cable band.

Separated line, an independent line segment. Each part is defined by a vertex pair. It may appear in lines mode. The first two vertices indicate the first part, and the next vertex defines more parts. If the number of vertices is odd, ignore the last vertex. The State must be the same as the wire ring, but its usage is different: the vertex to be processed maintains the end point of the first current part, which is a Boolean identifier, this marker indicates whether the number of vertices is an odd or even number (starting or ending point of a part ).

A triangle band is a group of triangles shared by edges. It is represented by the triangle_strip mode. The first three vertices represent the first triangle (its order is also significantly common ). The next vertex and the previous two vertex define a new triangle. If there are less than three vertices, no element is created, as shown in Figure 2.4.

The State required for a triangle belt includes an identifier (indicating whether the first triangle has been completed), two stored vertices (such as vertices A and vertices B ), and a pointer indicates which saved vertex will be replaced by the next vertex. The pointer first points to vertex A, and each subsequent vertex switch uses some pointers. Therefore, the first vertex is saved as vertex A, the second vertex is saved as vertex B, and the third vertex is saved as vertex A, and so on. A triangle generated by any vertex after the second vertex is completed from vertex A, vertex B, and the current vertex (in order.

A triangle fan is similar to a triangle belt and has only one difference: after the first vertex, vertex B is always replaced by vertex B in the two stored vertices. It is represented in triangle_fan mode.

Separated triangle, represented in triangles mode. 3i + 1st, 3I + 2nd and 3I + 3rd vertices (in order) Determine I =, 2 ,..., n-1 triangles can draw 3I + k vertices. K can be 0, 1 or 2. If K is not 0, the last K vertex is ignored. For each triangle, vertex A is vertex 3I, and vertex B is vertex 3I + 1. Otherwise, the separated shape becomes the triangle band.

The sequence of triangle vertices, whether it is a triangle belt, a triangle fan, or a split triangle, is consistent in the light and polygon grating process.

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.