Suppose I use a texture rectagle in a shader, eg I've drawn it as
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex2f(0.0, 0.0);
glTexCoord2f(texSize, 0.0);
glVertex2f(texSize, 0.0);
glTexCoord2f(texSize, texSize);
glVertex2f(texSize, texSize);
glTexCoord2f(0.0, texSize);
glVertex2f(0.0, texSize);
glEnd()
Then in my shader I want to read an offset from the current pixel in the calculation, for a usual texture we can simply calculate the offset as below:
float offset = 1/texsize
vec2 bl=vec2(tex2D(tex,coords+offset)) +
vec2(tex2D(tex,coords-offset);
glFragColor=bl;
However, for a rectangle texture can I simply do the following?
float offset = 1;
vec2 bl=vec2(tex2D(tex,coords+offset)) +
vec2(tex2D(tex,coords-offset);
glFragColor=bl;
cheers