Home › Forums › PowerVR Insider Graphics › gl_FragCoord – value for lower-left-most pixel is (0.5, 0.5) or (0, 0) ?
This topic contains 1 reply, has 2 voices, and was last updated by Dark_Photon 2 years, 9 months ago.
I am using OpenGL ES 2.0 on a PowerVR SGX544-MP2.
I would like whether the variable ‘gl_FragCoord’ returns (0.5, 0.5) for the lower-left-most pixel in a window (like it is defined in OpenGL, see https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml), or whether it returns (0.0, 0.0) ?
OpenGL & OpenGL ES use 0,0 for the edge of the window/texture/etc. For gl_FragCoord.xy, pixel edges are on integer values.
However, the location the fragment is launched for is somewhere within a pixel. If you’re using single-sample rasterization, the fragment locations will be at pixel centers (offset 0.5,0.5).
So your gl_FragCoord.xy for the first row of pixels will probably be (0.5,0.5), (1.5,0.5), (2.5,0.5), etc.