gl_FragCoord — 現在のフラグメントのウィンドウ相対座標が含まれます
in vec4 gl_FragCoord ;
フラグメント言語でのみ使用可能な gl_FragCoord
は、フラグメントのウィンドウ相対座標 (x, y, z, 1/w) 値を含む入力変数です。
マルチサンプリングの場合、この値は、ピクセル内の任意の場所、またはフラグメントサンプルの1つに適用できます。
この値は、頂点処理後にプリミティブを補間してフラグメントを生成する固定機能の結果です。
z コンポーネントは、シェーダーに gl_FragDepth への書き込みが含まれていない場合に、フラグメントの深度に使用される深度値です。
gl_FragCoord
may be redeclared with the additional layout qualifier identifiers
origin_upper_left
or pixel_center_integer
. By
default, gl_FragCoord
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
gl_FragCoord
may be changed by redeclaring gl_FragCoord
with the origin_upper_left
identifier. The values returned can also be
shifted by half a pixel in both x and y by pixel_center_integer
so it
appears the pixels are centered at whole number pixel offsets. This moves the (x, y) value returned by
gl_FragCoord
of (0.5, 0.5) by default to (0.0, 0.0) with
pixel_center_integer
.
If gl_FragCoord
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 gl_FragCoord
. Redeclaring
gl_FragCoord
with any accepted qualifier affects only gl_FragCoord.x
and gl_FragCoord.y
. It has no affect on rasterization, transformation or any other part
of the OpenGL pipeline or language features.
OpenGL Shading Language Version | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Variable Name | 1.10 | 1.20 | 1.30 | 1.40 | 1.50 | 3.30 | 4.00 | 4.10 | 4.20 | 4.30 | 4.40 | 4.50 |
gl_FragCoord | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
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. http://opencontent.org/openpub/.