OpenGL ES 3.0 fragment shader (4), opengles

Source: Internet
Author: User

OpenGL ES 3.0 fragment shader (4), opengles

Fragment shader Flowchart

Fragment shader (fragment shader) implements a general method for programmable fragment operations.

Each segment generated by Rasterization.

 

• Shader program-the source code or description of the fragment Shader program can perform operations on the fragment.

• Input variables (Input variables)-the interpolation technology is used in the raster phase to generate Vertex coloring er output for the segment coloring Machine

• Uniforms-constant data of the fragment shader

• Specific types used by Samplers-Uniforms, used by the fragment shader in the Texture (Texture)

 

Fragment coloring can discard the fragment or generate one or more color values as the output. Normally, the part coloring outputs

A single color value, in addition to rendering to multiple rendering targets. In the latter case, each color value is a rendering target.

. The color, depth, template, and screen Coordinate Position (XW, YW) produced by rastering become

OpenGL ES 3 input in the operation phase.

 #version 300 es precision mediump float; in vec4 v_color;  out vec4 fragColor;  void main() {     fragColor = v_color; }

Precision mediump float

Set the default precision

In vec4 v_color

Enter the color attribute.

Out vec4 fragColor

Output Color Attribute

FragColor = v_color

The input of the fragment shader is transmitted to linear interpolation of elements before the fragment is colored.

Operation Procedure for each clip

• Pixel ownership test-this test determines whether the pixels of a point (Xw, Yw) in the frame buffer are currently owned by OpenGL ES, this test allows the Windows operating system to control whether the pixels in the frame buffer belong to OpenGL ES context. For example, the Windows system detects that the frame buffer of OpenGL ES is blocked by another window, the Windows system can block the content of OpenGL ES and does not display it.

• Scissor test -- test (Xw, Yw) whether the part is in the cut matrix. If it is outside the matrix, the part is discarded. Template deep test-determines whether the input segment should be discarded

• Stencel and depth tests-tests the depth of input segments on the template to determine whether the input segments are

Should be discarded

• Blending-mix the color of the new clip and the color stored in the color Buffer

• Dithering-used in combination of several colors to simulate a wide range of color modes at the end of the per-fragment phase, whether the segment color, depth value, and template value are written into the frame buffer depends on

Whether the masking space is used. For example, the color buffer can set whether the red color can be written into the color buffer.

At the end, the color, depth, and template value of the discarded fragment are written to the frame buffer. OpenGL ES provides an interface to read the pixel of a frame.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.