OpenGL ES graphics pipeline resolve

OpenGL ES 3.0 implement graphics pipeline having a programmable shader functions, as shown vertex shader and fragment shader stages is a programmable line in OpenGL ES 3.0.

2591144-636614f80a946331.png
OpenGL ES graphics pipeline

Vertex shader

  • Vertex shader input:
    1. --- a vertex shader program described in the program source code discolored performing operations on the vertex / executables
    2. Vertex shader input (attributes) --- provide data for each vertex by vertex array
    3. Unified variable (Uniform) --- invariant vertex data / still pictures using shader
    4. Sampler --- represents the apex of a special type of variable discolored uniform texture use
2591144-7d9b77f17c7e80eb.png
Vertex shader
  • Apex of the target mark of the Business:

    1. Matrix changing positions
    2. Calculation formula generation color per vertex lighting
    3. ⽣ into / texture coordinates conversion

    Conclusion: It can be used to perform a fixed function Custom calculation, implementation of the new transform, lighting or not permitted based on the conventional vertex effect

  • GLSL vertex shader Code Case:

attribute vec4 position;
attribute vec2 textCoordinate; 
uniform mat4 rotateMatrix; 
varying lowp vec2 varyTextCoord; 
void main()
{
    varyTextCoord = textCoordinate; 
    vec4 vPos = position;
    vPos = vPos * rotateMatrix;
    gl_Position = vPos;
}

Element Assembly

After the vertex is discolored, the next stage is the primitive assembly.

  • Primitives (Primitive): point, line, shape, etc. ⻆ three geometric objects.

Element assembly: calculated vertex data into one primitive at this stage performs clipping, and perspective divide Viewport transform operation.

Single primitive will be rendered primitive type and the determined vertex. Operations performed for each individual vertices and corresponding primitive, primitive assembly stage comprising: a vertex discolored output value performs clipping, perspective divide, depending on the START-connector backward raster conversion stage.

Rasterization

At this stage the corresponding drawing primitives (points / lines / triangles). FIG rasterization element is converted into a set of two-dimensional section of the process. ⽽ the transformed fragments discolored by processing the fragment. These two-dimensional section of the screen is on the pixel can be drawn.

Release segment is significantly discolored / still picture element is significantly discolored

  • Still pictures shader / release segment significantly discolored Input:
    1. The discolored slice execution program operating on the metadata fragment described --- discolored program source code / executables
    2. The input vertex discolored output variable START --- raster interpolation unit for each generated segment
    3. ⼀ system variable (Uniform) --- vertex / fragment with the same data used by the color discolored
    4. Sampler --- represents the apex of a special type of variable discolored uniform texture use
2591144-f383a9be7e7e577e.png
Business cards yuan is significantly discolored
  • Business cards with discolored yuan in the traffic:
    1. Computing color
    2. Obtaining texture values
    3. To fill color pixel value (texture value / color value)

Summary: It can be used for image / video image color fill / each pixel (for example, to add filters to the video, the video is actually in the color of each pixel of the image to be modified is filled.)

  • Code fragment shader GLSL Case:
varying lowp vec2 varyTextCoord; 
uniform sampler2D colorMap; 
void main()
{
    gl_FragColor = texture2D(colorMap, varyTextCoord);
}

By operating segment

2591144-2a52f2b6e566dec1.png
By operating segment
  • Pixel Home Test: determining a previous frame buffer position (Xw, Yw) pixels destination time is not attributable to OpenGL ES All e.g., if a display OpenGL ES frame buffer View is shielded Further ⼀ a View the window system. determining shaded pixel does not belong OpenGL ES context. insufficiency thereby display pixels. ⼀ the pixel is part of the home test OpenGL ES, which help to open the developer human control, but by the internal OpenGL ES.
  • Test Crop: Cutting test determines (Xw, Yw) is located within a portion of a cropping rectangle state if the OpenGL ES release segment is located outside the clipping region, were discarded.
  • Depth Test: START input depth value than the fragments are ⽐, determining whether to reject the segment test
  • Mixing: a new release segment generated color values ​​stored in locations of colors in the frame buffer are combined.
  • Jitter: jitter can be minimized because Use to use finite precision color value stored ⽽ artifacts generated in the frame buffer.

Guess you like

Origin blog.csdn.net/weixin_34211761/article/details/90806446