Imagine I have two uncompressed, 2D textures A and B with identical sizes and formats. I bind A to texture unit 0, and B to a framebuffer object.
If I draw a full-size polygon in that framebuffer with this pixel shader:
uniform sampler2D iChannel0;
out vec4 fragColor;
void main()
{
fragColor = texelFetch(iChannel0, gl_FragCoord.xy);
}
Is this guaranteed to make a perfect copy of texture A?
ie. Will gl_FragCoord.xy give good numbers that map every input texel to every output texel? Will there be any filtering or clamping applied to the texels?
Edit: It should be
fragColor = texelFetch(iChannel0, ivec2(gl_FragCoord.xy), 0);