difference in accessing texture

hello,
is there a difference between these two methods
accessing a texture ?



uniform sampler2D texImage;
uniform vec2 inv_screen;  // inverse of screensize (1/x, 1/y)
in vec3 gs_TexCoord;
out vec4 gs_FragColor;

void main(void)
{
   //method a
   gs_FragColor = texture2D(texImage, gs_TexCoord);
   // method b
   gs_FragColor = texture2D(texImage, gl_FragCoord.xy * inv_screen);
}

for me there is no difference in method a and b. both texture
coordinates are in the range [0,1]. So I sometimes
read method b in some tutorials. Is there a reason for method b or does it just depends on the mood of the programmer ?

regards,
lobbel

Method b does not need texturecoords, that can be useful sometimes.

thanks.

regards,
lobbel

I just used the gl_FragCoord.xy approach with great success to access the depth buffer in a fog shader. In this case the polygon coords were meaningless.

My question: is there any way to find the viewport width/height without passing them in as uniforms?

My question: is there any way to find the viewport width/height without passing them in as uniforms?

No.

Shucks! Thanks, though :sorrow: