1. OpenGL rendering architecture is shown in the figure below:
The programmable locations are Vertex shader and Fragment shader.
In a programmable shader, as shown in the figure, we can pass data to the vertex shader in attrbutes and imaginative, and in textures according to the prime. But we cannot use attributes to pass values to the slice shader. The vertex shader passes values to the chip shader using Varing.
In fixed shaders, the triangle batch class is used to pass values.
2. Fix shader type:
- Unit shader – All segments of the graph are filled in with one color
- Flat shader – When drawing graphics, you can apply changes (model/projection changes)
- Color shader – When drawing a graph, you can apply a transform and the color will be smoothly inserted between vertices, called smooth shader
- Default light shader – When drawing graphics, transformations can be applied. This shader creates shadows and lighting effects on the drawn graphics
- Point light shader – The difference from the default light shader is that you can set the position of the point light
- Texture replacement matrix shader
- Texture light shader
3. Primitive connection mode
- GL_POINTS Each vertex is a separate point on the screen
- GL_LINES Each pair of vertices defines a line segment
- GL_LINE_STRIP A line drawn from the first vertex through each subsequent vertex
- GL_LINE_LOOP is the same as GL_LINE_STRIP, but the last vertex is joined to the first vertex
- GL_TRIANGLES use three vertices to form a triangle
- GL_TRIANGLE_STRIP Triangle strip, add a vertex, reuse the previous two vertices, form a new triangle.
- GL_TRIANGLE_FAN A group of triangles with adjacent vertices fan-shaped around an origin
4. The triangle
In OpenGL, counterclockwise is front and clockwise is back. This can be modified using GlfrontFace. GlfrontFace (cl_CW), tells OpengL that the polygon circled clockwise is front. Glfrontface (gl_CCW) tells openGl that a counterclockwise polygon is a front, a concept that will be used in future front and back culling.