From OpenGL Reference
Jump to navigation Jump to search

Contains the location of the current sample within the current fragment.



gl_SamplePositionis a fragment language input variable that contains the location within a fragment of the sample currently being processed. The x and y components ofgl_SamplePositioncontain the sub-pixel coordinate of the current sample and will have values in the range 0.0 to 1.0. The sub-pixel coordinates of the center of the pixel are always (0.5, 0.5). Any static use ofgl_SamplePositioncauses the entire fragment shader to be evaluated per-sample rather than per-fragment. When rendering to a non-multisample buffer, or if multisample rasterization is disabled,gl_SamplePositionwill be (0.5, 0.5).

Version Support[edit]

gl_SamplePosition 4.0+

See Also[edit]

 gl_SampleID , gl_SampleMask , 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.