title: opengl, Black lines in-between tiles
body: <p>When its translated in an integral value (1,2,3, etc....), there are no black lines in-between the tiles, it looks fine. But when it's translated to a non-integral (1.1, 1.5, 1.67), there are small blackish lines between each tile (I'm imagining that it's due to subpixel rendering, right?) ... and it doesn't look pretty =P</p>
  
  <p>So... what should I do?</p>
  
  <p>This is my image-loading code, by the way:</p>
  
  <pre><code>bool Image::load_opengl() {
      this-&gt;id = 0;
  
      glGenTextures(1, &amp;this-&gt;id);
  
      this-&gt;bind();
  
      // Parameters... TODO: Should we change this?
      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
      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_REPEAT);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, this-&gt;size.x, this-&gt;size.y,
     0, GL_BGRA, GL_UNSIGNED_BYTE, (void*) FreeImage_GetBits(this-&gt;data));
  
      this-&gt;unbind();
  
      return true;
  }
  </code></pre>
  
  <p>I've also tried using:</p>
  
  <pre><code>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  </code></pre>
  
  <p>Here is my image drawing code:</p>
  
  <pre><code>void Image::draw(Pos pos, CROP crop, SCALE scale) {
      if (!this-&gt;loaded || this-&gt;id == 0) {
          return;
      }
  
      // Start position &amp; size
      Pos s_p;
      Pos s_s;
  
      // End size
      Pos e_s;
  
      if (crop.active) {
          s_p = crop.pos / this-&gt;size;
          s_s = crop.size / this-&gt;size;
          //debug("%f %f", s_s.x, s_s.y);
          s_s = s_s + s_p;
          s_s.clamp(1);
          //debug("%f %f", s_s.x, s_s.y);
      } else {
          s_s = 1;
      }
  
      if (scale.active) {
          e_s = scale.size;
      } else if (crop.active) {
          e_s = crop.size;
      } else {
          e_s = this-&gt;size;
      }
  
      // FIXME: Is this okay?
      s_p.y = 1 - s_p.y;
      s_s.y = 1 - s_s.y;
  
      // TODO: Make this use VAO/VBO's!!
      glPushMatrix();
  
          glTranslate(pos.x, pos.y, 0);
  
          this-&gt;bind();
  
          glBegin(GL_QUADS);
  
              glTexCoord2(s_p.x, s_p.y);
              glVertex2(0, 0);
  
              glTexCoord2(s_s.x, s_p.y);
              glVertex2(e_s.x, 0);
  
              glTexCoord2(s_s.x, s_s.y);
              glVertex2(e_s.x, e_s.y);
  
              glTexCoord2(s_p.x, s_s.y);
              glVertex2(0, e_s.y);
  
          glEnd();
  
          this-&gt;unbind();
  
      glPopMatrix();
  }
  </code></pre>
  
  <p>OpenGL Initialization code:</p>
  
  <pre><code>void game__gl_init() {
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluOrtho2D(0.0, config.window.size.x, config.window.size.y, 0.0);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glDisable(GL_DEPTH_TEST);
      glEnable(GL_BLEND);
      glEnable(GL_TEXTURE_2D);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  }
  </code></pre>
  
  <p>Screenshots of the issue:</p>
  
  <p><img src="https://i.stack.imgur.com/Em1I1.png" alt="Screenshot 1">
  <img src="https://i.stack.imgur.com/1mTuj.png" alt="Screenshot 2"></p>