title: how to map a texture onto a grid of tiles seamlessly?
body: <p>I have a grid of 8 X 8 points and want to overlay an image on it. I divide the inner grid of 6 X 6 into 4 equal sub-parts of size 3 X 3 each. Let us call this sub-part as tile. The idea is to render these tiles along with their corresponding textures. I divide the grid into tiles because in future I want to test it on a larger grid.
  I have done it using following approach but I get seams along the edges. I can't figure out why the seams appear.</p>
  
  <p>First the tiles have corresponding starting co-ords as {(0,0),(0,3),(3,0),(3,3)}.</p>
  
  <p>I have an image of 8 X 8 size which I want to overlay on the super_grid and I store its rgba values in some super_data(8 X 8).</p>
  
  <p>While rendering the tiles I draw them as quads and then overlay the corresponding texture on them. So, if (a,b) are starting co-ords for a particular tile, then I initialize the
  quad vertices ={(a-0.5,b-0.5),(a+3-0.5,b-0.5),(a+3-0.5,b+3-0.5),(a-0.5,b+3-0.5)}
  and if xs = 1/(tileWidth+1)=1/(3+1)=1/4 and ys =1/(tileHeight+1)=1/4, then 
  texture Coordinates are {(xs/2,ys/2),(1-xs/2,ys/2),(1-xs/2,1-ys/2),(xs/2,1-ys/2)}</p>
  
  <p>So, for the first tile,</p>
  
  <pre><code>quadVertices={(-0.5,-0.5),(3.5,-0.5),(3.5,3.5),(-0.5,3.5)}
  textureCoords={(1/8,1/8),(1-1/8,1/8),(1-1/8,1-1/8),(1/8,1-1/8)}.
  </code></pre>
  
  <p>Before, passing a texture for the tile I initialize the texture : int image = new int [tileWidth+2] [tileHeight+2] by using the super_data. We take these dimensions because some part of tile texture overlap with the adjacent tiles(that is the reason why we account for this part while calculation of quadVertices).</p>
  
  <p>Finally, to generate the texture, use</p>
  
  <pre><code>glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tileWidth + 2, tileHeight + 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, image); 
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  </code></pre>
  
  <p>Everything above works fine, I get a grid with image overlayed on it. However, I get seams at the edges. How can I get rid of the seams?</p>