OpenGL ES 3.0. In my fragment shader I lookup texels from a texture like this
vec4 texel = texture( sampler2D , vec2(v_coord.x+u_offsets[i],v_coord.y) )
where v_coord is a vertex attribute and u_offsets[i] is an uniform array. This works, but I can see that it ‘wraps up’ the texel coordinates, i.e. it really looks like
texture( sampler2D, vec2(1.1,0.2) ) = texture( sampler2D, vec2(0.1,0.2) )
So whenever some texture coordinate is out of the [0,1] interval, the texture() function maps it into the interval and fetches a texel from there.
This behaviour is undesirable. I’d much rather have it return some pre-programmed solid color whenever the coordinates are out of [0,1]x[0,1]. I know I can program this in my shader ( test if
v_coord.y are inside [0,1], if yes lookup the texel, if not - return a uniform color) - but maybe there’s a faster way?