+ Template depth test test

A: depth test

  1. Depth buffer (Depth Buffer) is blocked to prevent the rendering of the surface to the front surface of the other.
  2. Color depth buffer as a buffer (Color Buffer) (all fragments stored color: visual output) as stored information in each fragment, and (usually) the color buffer and has the same width and height. Depth buffer is automatically created by the window system , it will store the value of its depth 16, 24 or 32 in the form of a float. In most systems, the accuracy of the depth buffer is 24 bits.
  3. When the content of the depth test (Depth Testing) enabled, OpenGL fragment will be a depth buffer with the depth value comparison. OpenGL performs a depth test, if the test passes, then depth buffer will be updated to the new depth values. If the depth test fails, the segment will be discarded.
  4. A depth buffer (after the test and template (Stencil Testing) running) after the fragment shader run run in screen space . Closely related to the screen space coordinates defined by the viewport glViewport OpenGL and may be used as built-in variable gl_FragCoord GLSL accessed directly from the fragment shader. gl_FragCoord x and y screen space coordinate component represents the fragment (wherein (0, 0) located at the lower left corner).
  5. gl_FragCoord z also contains a component, which contains the fragment of the true depth value. z value is the value of the depth buffer needs content comparison.
  6. Try

Guess you like

Origin www.cnblogs.com/GarrettWale/p/11343650.html