 %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="gl_FragCoord">
    <info>
        <copyright>
            <year>2011-2013</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>gl_FragCoord</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>gl_FragCoord</refname>
        <refpurpose>contains the window-relative coordinates of the current fragment</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Declaration</title>
        <fieldsynopsis>
            <modifier>in</modifier>
            <type>vec4</type>
            <varname>gl_FragCoord</varname>
        </fieldsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            Available only in the fragment language, <varname>gl_FragCoord</varname> 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 <citerefentry><refentrytitle>gl_FragDepth</refentrytitle></citerefentry>.
        </para>
        <para>
            <varname>gl_FragCoord</varname> may be redeclared with the additional layout qualifier identifiers
            <function>origin_upper_left</function> or <function>pixel_center_integer</function>. By
            default, <varname>gl_FragCoord</varname> assumes a lower-left origin for window coordinates
            and assumes pixel centers are located at half-pixel centers. For example, the (x, y) location
            (0.5, 0.5) is returned for the lower-left-most pixel in a window. The origin of
            <varname>gl_FragCoord</varname> may be changed by redeclaring <varname>gl_FragCoord</varname>
            with the <function>origin_upper_left</function> identifier. The values returned can also be
            shifted by half a pixel in both x and y by <function>pixel_center_integer</function> so it
            appears the pixels are centered at whole number pixel offsets. This moves the (x, y) value returned by
            <varname>gl_FragCoord</varname> of (0.5, 0.5) by default to (0.0, 0.0) with
            <function>pixel_center_integer</function>.
        </para>
        <para>
            If <varname>gl_FragCoord</varname> is redeclared in any fragment shader in a program, it must be redeclared
            in all fragment shaders in that program that have static use of <varname>gl_FragCoord</varname>. Redeclaring
            <varname>gl_FragCoord</varname> with any accepted qualifier affects only <varname>gl_FragCoord.x</varname>
            and <varname>gl_FragCoord.y</varname>. It has no affect on rasterization, transformation or any other part
            of the OpenGL pipline or language features.
        </para>
    </refsect1>
    <refsect1 xml:id="versions"><title>Version Support</title>
        <informaltable>
            <tgroup cols="11" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="varhead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry>gl_FragCoord</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="version.xml" xpointer="xpointer(/*/*[@role='11']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>gl_FragCoord</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 2011-2013 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.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>
