Related Contents:

  1. OpenGL– An introduction to the graphics API
  2. OpenGL– Related terms explained
  3. OpenGL– Environment configuration
  4. OpenGL- Case 1- Draw a triangle
  5. OpenGL– Case 2 — Draw a square
  6. OpenGL– Image rip
  7. OpenGL–3D mathematics related (Vectors and Matrices)
  8. OpenGL– Matrix transformations and matrix stacks

In order to learn more about OpenGL, let’s take a look at some of the proper terms in OpenGL

OpenGL Context

  • OpenGL Context, an OpenGL Context is created before an application calls any OpenGL instruction. This context is a very large state machine, which holds various states in OpenGL and is the basis for the execution of OpenGL instructions.
  • OpenGL functions no matter in which language environment, are similar to C language as process-oriented functions, essentially are OpenGL context this huge state machine in a state or object operation, of course, the first object to be set as the current object. Therefore, the OpenGL instructions can be wrapped to encapsulate the related calls into an object-oriented graphical API.
  • Since the Context is a very large state machine, switching the Context can be expensive, but different drawing modules may need to use completely separate state machines for state management. As a result, you can create multiple different contexts in your application, use different contexts in different threads, and share textures, buffers, and so on.
  • All draw commands in OpenGL work on the Current Context, and the Current Context is a thread-local variable, which means that if we draw in a thread, You need to specify a CurrentContext for each thread, and multiple threads cannot specify a CurrentContext at the same time.

OpenGL state machine

Concept:

Personally, a state machine is equivalent to a machine existing in theory. It keeps its various states, and then the user asks it to change a certain state by inputting a command.

Features:

1. With memory function, able to remember their current state

2. Can receive input, according to the input content and their current state to modify their own state, and can get the output

3. When it enters a special state (shutdown), it no longer receives input and stops working

Apply colours to a drawing

  • The operation of converting graphic/image data into 2D spatial graphics.

Vertex arrays and vertex buffers

  • ** Vertex data: ** also known as vertex attributes, specifies the data for each vertex. The specified vertex data attribute can be specified for each vertex with an array of vertices, or a constant value can be applied to all vertices of an element.
  • ** VertexArray (VertexArray): ** VertexArray (VertexArray): ** VertexArray (VertexArray): VertexArray (VertexArray): VertexArray (VertexArray): VertexArray (VertexArray): VertexArray (VertexArray): VertexArray (VertexArray): VertexArray (VertexArray) An array of vertices specifies the attributes of each vertex and is stored in a buffer in the application’s address space. The most common storage methods for vertex attributes include structured array and array structure.
  • ** VertexBuffer: ** to improve performance, a block of extents is allocated ahead of time and vertex data is prepassed into the extents. This part of video memory is called the vertex buffer.

pipeline

A pipeline (rendering pipeline) can also be called a rendering pipeline or pixel pipeline or pixel pipeline. Think of it as an assembly line in a factory. Each task in the pipeline is executed like an assembly line, and there is a sequence of tasks. Pipeline is an abstract concept. It is called pipeline because the graphics card processes data in a fixed order, in strict accordance with this order and not allowed to disrupt, similar to the assembly line in a factory.

Fixed line

Early versions of OpenGL include shader blocks that include lighting, coordinate conversion, clipping and other functions to help developers render graphics. Developers can quickly render graphics by passing in the appropriate parameters.

Programmable pipeline

Later, due to the use of OpenGL gradually rich, fixed pipeline can not complete every business, at this time pointing to the relevant part of the function opened into programmable, programmable pipeline was born.

Shaders (Shader)

When the fixed render pipeline architecture becomes a programmable render pipeline, OpenGL also needs to specify a shader program compiled by the Shader before calling the draw function.

Common shaders are the VerterShader, A FragmentShader/PixelShader, geometrysshader, a Surface Subdivision Shader. In OpenGL ES 3.0, only vertex shaders and slice shaders are supported.

VertexShader (VertexShader)

  • Generally used to deal with the transformation of each vertex of the graph (rotation/translation/projection, etc.)
  • OpenGL is used to calculate the vertex properties of the program, vertex shader isPer-vertex operationThat is, the vertex shader is executed once for each vertex, concurrently, and no other vertex data can be accessed during the vertex shader operation
  • Generally speaking, the vertex attributes that need to be calculated mainly include vertex coordinate transformation, vertex light operation, etc., and the operation of vertex coordinate transformation from its own coordinate system to normalized coordinate system also takes place here

FragmentShader

  • Generally used to deal with the calculation and filling of the color of each pixel in the graph
  • Is used in OpenGL to calculate the color of the fragment (pixel), is a per-pixel operation, that is, each pixel will execute a slice shader, of course, also concurrently

GLSL (OpenGL Shading Language)

OpenGL coloring language, used for coloring programming, he is on the GPU (Graphic Process Unit) on the execution, instead of a fixed part of the rendering pipeline, rendering pipeline in different levels with programmable, such as view conversion, projection conversion and so on. The GLSL Shader code is divided into two parts: Vertex Shader and Fragment Shader.

The rasterizer (Rasterization)

  • The process of converting vertex data into tiles has the effect of converting a graph into a grid of images, characterized by each element corresponding to a pixel in the frame buffer
  • Rasterization is actually a process of transforming geometric elements into two-dimensional images. The process consists of two parts: the first part determines which integer grid areas of the window coordinates are occupied by the base primions, and the second part assigns a color value and a depth value to each area.
  • The rasterization process produces slices.
  • The process of converting the mathematical description of an object and the color information associated with the object into the pixels for the corresponding position on the screen and the colors for filling the pixels is calledrasterizer. This is a willAnalog signalintoDiscrete signalIn the process.

Texture (Texture Texture)

  • Texture mapping: a two-dimensional drawing or drawings showing surface details of an object. Objects can look more realistic when textures are mapped to the surface in a specific way. Texture mapping is a technique that allows us to assign image data to triangles, which allows us to represent our scene in a more nuanced and realistic way.
  • It can also be interpreted as a picture. In order to make the scene more realistic when rendering graphics, it is necessary to fill the image in its code. The images used here are often referred to as textures. But in OpenGL, we’re more used to calling it texture, not image.

Hybrid (Blend)

  • Mixing is theThe source of colorThe target colorThe technique of mixing special effects in a certain way. Blending is often used to draw transparent or translucent objects, and the α value that plays a key role in blending is actually mixing the source and target colors in a given proportion to achieve varying degrees of transparency. A value of alpha 0 is completely transparent, and a value of alpha 1 is completely opaque.
  • The blending operation can only be performed in RGBA mode, and the α value cannot be specified in color index mode
  • The order in which objects are drawn affects how OpenGL mixes

matrix

Linear algebra ~

3 d math ~

Transformation matrix

When the graph wants to translate, scale, rotate and so on, it needs to use the transformation matrix.

Projection matrix

Used to convert 3D coordinates to 2d screen coordinates where the actual lines will also be drawn.

conclusion

The above is all the content of this time, mainly for the later study of OpenGL will be designed to explain some nouns, may not be very comprehensive, I hope friends to add more.

Harmonious learning, not impatient ~