Texture coordinates for full-screen effect

when rendering full-screen effects, one usually renders the effect to a texture and then blends a full-screen quad with this texture applied over the scene. for an effect i’m working on atm, i’d prefer to use this texture in a shader directly instead… but how would i compute the texture coordinates most efficiently for each fragment then?

… thanks!

If I understand you correctly, you want to render a RTT to a quad on the screen? If its a single quad why wouldn’t it be 0-1 coordinates?

no. let’s say u_kTexture0 is the texture i rendered the scene to.

uniform sampler2D u_kTexture0;

void main()
vec2 kCoordinates = ???;

gl_FragColor = texture2D( u_kTexture0, kCoordinates )

how would i have to calculate kCoordinates so that the output is the same as if i had rendered a full-screen quad with the texture applied?

vec2 kCoordinates = 0.5 * (gl_FragCoord.xy + vec2(1.0));

should do the trick, even if it has some objectionable counterparts

oha so simple… works thanks :slight_smile: what counterparts?

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