Quote:Original post by idinev
float2 ScreenSize=float2(1280,720);
gl_FragCoord.xy = (((IN.Pos.xy / IN.Pos.w) + 1) / 2) * ScreenSize + 0.5;
And also, (gl_FragCoord.xy - 0.5) is always integer. [0..1279][0..719]
You don't need to do that division by gl_FragCoord.w :)
You should not write to gl_FragCoord. It is read only.
Furthermore, no need to multiply by screen size because gl_FragCooord is already in window space.
All I'm saying is that since gl_FragCoord.xy contains high values, that they will get clamped.
As a result
gl_FragColor = vec4(FragCoord.x , FragCoord.y , 0.0 , 1.0);
will just show yellow.
PS : you can write that as
gl_FragColor = vec4(FragCoord.xy, 0.0 , 1.0);