I am having problems with texture fetching and fetching outside the texture. I set the texture for GL_CLAMP_TO_EDGE to wrap, so when the texture goes out of bounds, it captures the edge:
glBindTexture(GL_TEXTURE_2D, m_color_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
In my shader, I am trying to implement DoF effects, the problem I encountered is to see a lot of small squares, so I started experimenting. I use the deferred rendering method, so for these effects I draw a full-screen box, inside my shader file the following:
uniform sampler2D color_texture;
uniform vec2 Resolution;
out vec4 fragment_colour;
void main(void)
{
vec2 inverseVP = vec2(1.0 / Resolution.x, 1.0 / Resolution.y);
vec2 coord = gl_FragCoord.xy * inverseVP;
vec4 texel_color = texture(color_texture, coord + (vec2(0.0, 0.1)));
fragment_colour = texel_color;
}
Color_texture is the accumulation of all of my drawing from my FBO. In the shader, I just compensate the read pixel by 10% of the texture size. However, when I try to do this, I get the following result:

, , , , . , , , , .
- ?