title: Manual GL_REPEAT in GLSL
body: <p>Currently I have a texture atlas that is 2048 x 2048 pixels set up with three 512 x 512 textures stored, and I am only applying one texture to the object. So I used the following code to position the texture coordinates (from zero to 1) to the correct position on the texture atlas for that texture:</p>
  
  <pre><code>color = texture2D(tex_0, vec2(0.0, 1024.0/2048.0) + mod(texture_coordinate*vec2(40.0), vec2(1.0))*vec2(512.0/2048.0));
  </code></pre>
  
  <p>The problem is that when I apply this, there is a black border around the texture. I presume that this is because OpenGL can't blend the two pixels at the place of that border.</p>
  
  <p>So how do I get rid of the border?</p>
  
  <p>Edit*
  I have already tried to move the starting and ending boundaries in toward the center of the texture and that didn't work.</p>
  
  <p>Edit*
  I found the source of the problem, the automatic mipmap generation is blending the textures in the texture atlas together. This means I have to write my own mipmapping function. (As far as I can tell)</p>
  
  <p>If anyone has any better ideas, please do post.</p>