From OpenGL Reference
Jump to navigation Jump to search

Establishes a depth value for the current fragment.



Available only in the fragment language,gl_FragDepthis an output variable that is used to establish the depth value for the current fragment. If depth buffering is enabled and no shader writes togl_FragDepth, then the fixed function value for depth will be used (this value is contained in the z component of gl_FragCoord ) otherwise, the value written togl_FragDepthis used. If a shader statically assigns togl_FragDepth, then the value of the fragment's depth may be undefined for executions of the shader that take that path. That is, if the set of linked fragment shaders statically contain a write togl_FragDepth, then it is responsible for always writing it.

Version Support[edit]

gl_FragDepth 1.1+

See Also[edit]



Copyright© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999.