gl_FragCoord and texture2DRect

I need some clarification as to whether any of this is wrong. gl_FragCoord.xy stores window (screen) coordinates of the current pixel, meaning if render a full screen quad in an 800x600 viewport, I would get gl_FragCoord.xy values of (0.5, 0.5) -> (799.5, 599.5)? Where
(0.5, 0.5) would be the first lower left pixel (assuming old opengl)?

And texture rectangles have unnormalized coordinates, so if I wanted to display an 800x600 texture rect, on a quad, I would assign tex coord (0.0, 0.0) to bottom left vertex and (799, 599) to top right vertex of the quad?
To access the first texel on the texture rect would use (0.0, 0.0) and increment by exactly 1.0 in each direction to access adjacent texels in the texture rect?

Which means if the quad fills the screen with this texture rect, and gl_FragCoord was this first screen pixel (0.5, 0.5), I should use
gl_FragCoord.xy - vec2(0.5, 0.5), to zero index the first texel in the and apply it to the first pixel at the bottom left on screen?

vec4 sample = texture2DRect(rectSampler, gl_FragCoord.xy - vec2(0.5, 0.5));

gl_FragCoord contains half pixel offsets in range of window (screen) dimensions?
texture rects index directly on round offsets? given texel 10 and 11, 10.5 would be sampling between them?

Would that be right?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.