Previous: http://www.bkjia.com/kf/201206/137160.html
Appearance and discount of shapes
In OpenGL, the appearance of a shape is defined by more points in three or three dimensions. A set of three or more 3D points (called vertices in OpenGL) can be divided into front and back. How can we know which is the front and which is the back? To answer this question, we need to use a break or define the direction of the point in the shape.
Figure 1. The figure shows a list of coordinates that are converted into a counter-clockwise drawing order.
In this example, the points of a triangle are defined in the order they are drawn counterclockwise. These plots use the sequence of coordinates to define the direction of the points. By default, the area drawn counterclockwise in OpenGL is the front. Figure 1. The triangle definition shown in the figure shows the front of the graph (as OpenGL explains), and the other edges are the back.
Why is it important to know the aspect of a graph? This is related to the Face Culling function in OpenGL. Face Culling is an optional feature of the OpenGL environment. It allows the rendering pipeline to ignore (not compute or draw) The back of the image during storage, memory, and processing cycle:
// Enable face culling feature
Gl. glable (GL10.GL _ CULL_FACE );
// Specify which faces to not draw
Gl. glCullFace (GL10.GL _ BACK );
If you try to use the Face filter function, but you do not know that the edges are the front and back of the shape, the OpenGL image looks a little thin, or the image is not displayed at all. Therefore, the coordinates of OpenGL images must always be defined in a counterclockwise order.
Note: You can also use clockwise sequence as the front to set the OpenGL environment. However, this requires more code and can cause confusion for OpenGL developers. Therefore, do not do this.