   GLSL: How to get pixels around a processed fragment?
  I have a fairly complex scenario: An applied texture (512x512) requires some color adjustment in the fragment shader. It means colors with known values need to be remapped to something else. The difficulty is that this task needs to be done in dependancy to surrounding pixels. Basically all that is required to be done is: Get fragment color, check if it is correct, if not adjust it. This process needs to check surrounding pixels in order to be able to determine the color.Now what can I do? I thought I render the first pass to a 512 x 512 texture and then in the second pass I check the fragment and its surrounding colors. But how  exactly can I access neighbor pixels (not fragments) I have a sampler and the texture2D method but everything is based on [0;1] coordinates, so this step is tricky. What is the action here? I know the render texture is 512 x 512, so do I need some hacks like setting the texture minify and magnify to NEAREST to avoid interpolation and then calculate a "pseudopixel" which is 1/512 ?This scenario looks somehow very constructed.   
  If you want to access a neighbor texel, the offset would be 1.0/512.0.The other way is exact texture coordinates. You would need GL_ARB_texture_rectangle to do this.   ;  What is the common way to use the GL_ARB_texture_rectangle? I cant put it into a context right now   ;  An easy way is to replace GL_TEXTURE_2D usage with GL_TEXTURE_RECTANGLE_ARB, which has 2 differences:- Textures can be NPOT.- Textures don't have mipmapping, and texture repeat isn't supported.What you gain is texture coordinates in pixel space, from 0 to width/height, in which the offset for your problem is 1.   