Light | Dark

# docs.GL

GLSL 4
GLSL ES 3

# gl_FragCoord

## Name

gl_FragCoord — contains the window-relative coordinates of the current fragment

## Declaration

`in highp vec4 gl_FragCoord ;`

## Description

Available only in the fragment language, `gl_FragCoord` is an input variable that contains the window relative coordinate (x, y, z, 1/w) values for the fragment. If multi-sampling, this value can be for any location within the pixel, or one of the fragment samples. This value is the result of fixed functionality that interpolates primitives after vertex processing to generate fragments. The z component is the depth value that would be used for the fragment's depth if no shader contained any writes to gl_FragDepth.

## Version Support

| OpenGL ES Shading Language Version
--- | ---
Variable Name | 1.00 | 3.00 | 3.10
gl_FragCoord | ✔ | ✔ | ✔

## See Also

gl_FragDepth

## Copyright

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. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.