Original: http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/primitive-assembly/
The element assembly phase takes the data of the vertex shader as input, and how the vertices are combined is indicated by the application calling the OpenGL function gldraw* (the orange part of the figure).
The connection of vertices illustrates how vertices are combined into entities. The elements can be dots, lines, triangles, or patches. In addition, the adjoining information can be provided. For example, the application also provides vertex data that generates adjacency elements. This data is only used in the geometry shader, how to not activate the geometry shader, then this information will be ignored.
The entity assembly outputs some primitives or patches. For example, if you enter a sequence of six vertices, and the connection information indicates that the vertices are joined to a triangle, 2 triangles are generated. For a triangle, it connects 6 vertices, generating 4 triangles that are joined together.
In opengl4+, patches is the input primitive type of the subdivision control shader. Patch is not the same as in the above, its vertex count is indeterminate, and the number of vertices of a patch can be from 1 to an implementation-dependent constant: Gl_max_patch_ VERTICES.
In graphics, it is generally assumed that the generated primitive type instance is a triangle, which can be described in the following steps:
The following table shows the possible set of vertex composition information and the resulting results, and the corresponding shader for using them:
Here are some examples of generating points, lines, and triangles. For an example of an entity with adjacency information, a solid line represents the primary entity (the generated entity), and the dashed lines connect to the adjacent vertices. It is important to note that in the graphical (connected) order, the entity is a counterclockwise order (CCW) connection.
The geometry interpolation of patches is not linear, so it is not shown here. For more information about patches, see the section shader segment.
GLSL Core tutorial–primitive Assembly