OpenGL FAQ and basic concept knowledge (continuously updated!!)
1. The concept of matrix in OpenGL, what is Model,View,Project?
We know the World in the OpenGL Matrix (World Matrix)/View Matrix (the View Matrix and Projection Matrix (the Projection matirx)
in the Model: the Matrix determine the World coordinates of a unified, mainly aimed at the Model of translation, rotation, scaling, shear, and other functions, is the Model from local space into World space.
Projection matrix is the part of the scene that we can see, with the camera/observer position and so on (set mouse movement, scroll wheel, etc.), and converts all world coordinates to View coordinates.
2. Scheduling between CPU and GPU in OpenGL
OpenGL program involves two types of processing unit CPU and GPU.
engl main program has CPU call to run, image processing part through GLSL to GPU execution.
Data transfer between CPU and GPU is divided into three steps:
1. First use the built-in OpenGL function to generate an ID number
2. According to the need for the ID number of memory types of binding, binding to be used in the receiving system after the completion of the GPU memory of the data in the “identifier” will be ready,
3. This part of memory is initialized. The initialized content is from the system memory, and this part of function is completed by the glBufferData function. After the data is submitted to the GPU dedicated memory, it is necessary to allocate the data according to the application scenarios, such as some data as vertices, some as colors, some for illumination control and so on
In addition, due to the high parallel structure of GPUs, all GPUs have high computational efficiency in processing graphics and complex algorithms. Most of the CPU area is controllers and registers, while GPUs have more ALUs, logical operational units for data processing, rather than data caching and flow control.
The concept of buffers in OpenGL
 Frame Buffer: A frame buffer is a combination of the following buffers. Using frame buffers allows you to render your scene into a different frame buffer, which allows you to create mirrors in the scene, or create cool effects that store data for the display.
 Color Buffer: Stores the color of all fragments: that is, the effect of visual output.
 Depth Buffer: determines which facets are occluded according to the Z value of the buffer. Automatically generated by GLFW.
 stencil buffer: Similar to depth testing, the template value is compared to the default value to determine whether to discard the fragment.
Data is processed in OpenGL in the following order: vertex shader – fragment shader – template test – depth test
The concept of depth testing
1. What is depth?
OpenGL will have a special area for storing Z value (the Z value on each pixel), which is the depth cache.
2. Depth Buffer Function?
In general, when we draw a graph, the later drawing overrides the previous graph, and the general drawing order is drawn from the back to the front. So there is a performance problem with the “covered part”, where the first part is covered, and all you see is the top part of the module and the bottom part of the covered part is not meaningful!
depth test appears to solve the covering problem
nction: when the depth test is turned on, the Z value will be checked. The same area close to the observer will be drawn, and other covered areas will not be drawn, regardless of the order of drawing.
3. How to use the deep cache test?
in the above code open depth test by default, the Z value under the condition of small will be overwritten
If the observer is in the positive direction of the Z axis, the Z value is close to the observer
If the observer is in the negative direction of the z-axis, the smaller z-value is closer to the observer
How to solve the conflict problem caused by the same depth value (same Z value)?
The first method: in the second drawing the same Z value, the tiny offset cover problems
note: must be very careful to ensure that the Z value of the gap, or like a refrigerator on the refrigerator as suspended risk code>
The second method is to sample the GLPolygonOffset function so that the depth value of the fragment can be adjusted so that the depth value is offset without creating a suspended emphasis
- Common problems of shadow map in OpenGL
- OpenGL development environment configuration [vs2017] + common problems
- OpenGL basic graphics programming – OpenGL and 3D graphics world
- OpenGL learning — problems encountered in compiling OpenGL program for the first time
- OpenGL Usage Summary (including problems encountered and solutions)
- Configure glut in Ubuntu and implement basic OpenGL experiment on CodeBlocks platform
- OpenGL learning notes: Problems and Solutions
- Linux common problems and Solutions
- Common problems and solutions under Linux
- Problems and solutions in learning opengl
- Some common problems in the use of vs2017
- Common problems of Aidl cross process communication
- Common problems of Hadoop startup error reporting
- Summary of problems encountered by CodeBlocks + OpenGL
- Summary of problems encountered in compiling opengl code
- Some problems in OpenGL
- Record the problems encountered in OpenGL learning
- Problems encountered in vs2015 configuration using OpenGL environment
- |-OpenGL – | some small problems about the glut Library
- Problems encountered in running OpenGL