Fragment Shader about the range of gl_TexCoord[0].st

I want to catch the color of one point and its neighbors.

like this
vec4 w3 = vec4(texture2D(tttTexture, vec2(gl_TexCoord[0].s+delp,gl_TexCoord[0].t-delp)));

How can I make sure the s+delp and the t-delp without overflow the range [0,1]

Is the st range from [0,1]?


Do clamp?

 clamp (gl_TexCoord[0].s+delp,0.,1.) 

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