title: Black lines between 2d textures
body: <p>I just started learning opengl technology.
  My program draw 2d isometric tiles and program output this:
  <img src="https://i.stack.imgur.com/PAIVN.png" alt="enter image description here" />Be unknown reasons black lines appear when two textures overlap or two textures touch.</p>
  <p>Code example:</p>
  <pre><code>typedef unsigned int ID;
  
  class GraphicEngine {
  public:
      GraphicEngine();
      ~GraphicEngine();
      void initShaders(const char* vertexShaderSource, const char* fragmentShaderSource);
      void initRenderData(float vertices[], unsigned int size);
      std::vector&lt;ID&gt; initTextures(std::vector&lt;std::string&gt;&amp; paths);
      void drawTextures(std::vector&lt;ID&gt; testuresIds);
  
  private:
      GraphicEngine(GraphicEngine&amp;) = delete;
      GraphicEngine(GraphicEngine&amp;&amp;) = delete;
      GraphicEngine&amp; operator=(const GraphicEngine&amp; other) = delete;
  private:
      unsigned int VBO = 0; 
      unsigned int VAO = 0;
      unsigned int EBO = 0;
      unsigned int shaderProgram;
  };
  
  GraphicEngine::GraphicEngine() {
  
  }
  
  GraphicEngine::~GraphicEngine() {
      glDeleteVertexArrays(1, &amp;VAO);
      glDeleteBuffers(1, &amp;VBO);
      glDeleteBuffers(1, &amp;EBO);
  }
  
  
  void GraphicEngine::initShaders(const char* vertexShaderSource, const char* fragmentShaderSource) {
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);
      unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
      shaderProgram = glCreateProgram();
      glShaderSource(vertexShader, 1, &amp;vertexShaderSource, NULL);
      glCompileShader(vertexShader);
      glShaderSource(fragmentShader, 1, &amp;fragmentShaderSource, NULL);
      glCompileShader(fragmentShader);
      glAttachShader(shaderProgram, vertexShader);
      glAttachShader(shaderProgram, fragmentShader);
      glLinkProgram(shaderProgram);
  }
  
  void GraphicEngine::initRenderData(float vertices[], unsigned int size) {
      unsigned int indices[] = {
          0, 1, 3,
          1, 2, 3
      };
      glGenVertexArrays(1, &amp;VAO);
      glGenBuffers(1, &amp;VBO);
      glGenBuffers(1, &amp;EBO);
  
      glBindVertexArray(VAO);
      glBindBuffer(GL_ARRAY_BUFFER, VBO);
      glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);
  
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
      glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
  
      glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
      glEnableVertexAttribArray(0);
      glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
      glEnableVertexAttribArray(1);
  }
  
  std::vector&lt;ID&gt; GraphicEngine::initTextures(std::vector&lt;std::string&gt;&amp; paths) {
      std::vector&lt;ID&gt; ids(paths.size());
      stbi_set_flip_vertically_on_load(true);
      for (int i = 0; i &lt; paths.size(); i++) {
          unsigned int texture;
          glGenTextures(1, &amp;ids[i]);
          glBindTexture(GL_TEXTURE_2D, ids[i]);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
          int width, height, nrChannels;
          unsigned char* data = stbi_load(paths[i].c_str(), &amp;width, &amp;height, &amp;nrChannels, STBI_rgb_alpha);
          if (data)
          {
              glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
              glGenerateMipmap(GL_TEXTURE_2D);
          }
          stbi_image_free(data);
      }
      return ids;
  }
  
  void GraphicEngine::drawTextures(std::vector&lt;ID&gt; testuresIds) {
      static bool ex = false;
      for (auto testureId : testuresIds) {
          for (int i = 0; i &lt; 4; i++) {
              glBindTexture(GL_TEXTURE_2D, testureId);
              glm::mat4 transform = glm::mat4(1.0f);
              transform = glm::translate(transform, glm::vec3(i * 0.6f + 0.0f, 0.0f, 0.0f));
              glUseProgram(shaderProgram);
              unsigned int transformLoc = glGetUniformLocation(shaderProgram, &quot;transform&quot;);
              glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));
              glBindVertexArray(VAO);
              glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
          }
          for (int i = 0; i &lt; 4; i++) {
              glBindTexture(GL_TEXTURE_2D, testureId);
              glm::mat4 transform = glm::mat4(1.0f);
              transform = glm::translate(transform, glm::vec3(i * 0.6f - 0.3f, -0.16f, 0.0f));
              glUseProgram(shaderProgram);
              unsigned int transformLoc = glGetUniformLocation(shaderProgram, &quot;transform&quot;);
              glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));
              glBindVertexArray(VAO);
              glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
          }
      }
  
  const unsigned int SCR_WIDTH = 800;
  const unsigned int SCR_HEIGHT = 600;
  
  Window::Window():window(nullptr) {}
  
  Window::~Window() {
      glfwTerminate();
  }
  
  bool Window::initWindowResources() {
      bool result = false;
      if (glfwInit() == GLFW_TRUE) {
          glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
          glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
          glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
          window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, &quot;LearnOpenGL&quot;, NULL, NULL);
          if (window != nullptr) {
              glfwMakeContextCurrent(window);
              if (glfwSetFramebufferSizeCallback(window, [](GLFWwindow* window, int width, int height) {
                  glViewport(0, 0, width, height); }) == NULL) {
                  if (gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
                      result = true;
                  }
              }
          }
      }
      return result;
  }
  
  const char* vertexShaderSource =
  &quot;#version 330 core\n&quot;
  &quot;layout(location = 0) in vec3 aPos;\n&quot;
  &quot;layout(location = 1) in vec2 aTexCoord;\n&quot;
  &quot;out vec2 TexCoord;\n&quot;
  &quot;uniform mat4 transform;\n&quot;
  &quot;void main()\n&quot;
  &quot;{\n&quot;
  &quot;    gl_Position = transform * vec4(aPos, 1.0);\n&quot;
  &quot;    TexCoord = vec2(aTexCoord.x, aTexCoord.y);\n&quot;
  &quot;}\n\0&quot;;
  
  const char* fragmentShaderSource =
  &quot;#version 330 core\n&quot;
  &quot;out vec4 FragColor;\n&quot;
  &quot;in vec3 ourColor;\n&quot;
  &quot;in vec2 TexCoord;\n&quot;
  &quot;uniform sampler2D texture1;\n&quot;
  &quot;void main()\n&quot;
  &quot;{\n&quot;
  &quot;    FragColor = texture(texture1, TexCoord);\n&quot;
  &quot;}\n\0&quot;;
  
  void Window::mainWindowLoop() {
  
      graphicEngine.initShaders(vertexShaderSource, fragmentShaderSource);
      std::vector&lt;std::string&gt; pathsTextures = { &quot;C:\\Users\\Олег\\\Desktop\\sea1.png&quot; };
      float vertices[] = {
          // positions          // colors           // texture coords
          -1.3f,  0.16f, 0.0f,  1.0f, 1.0f, // top right
          -1.3f, -0.16f, 0.0f,  1.0f, 0.0f, // bottom right
          -0.7f, -0.16f, 0.0f,  0.0f, 0.0f, // bottom left
          -0.7f,  0.16f, 0.0f,  0.0f, 1.0f  // top left 
      };
      graphicEngine.initRenderData(vertices, sizeof(vertices));
      std::vector&lt;ID&gt; idsTextures = graphicEngine.initTextures(pathsTextures);
      while (!glfwWindowShouldClose(window))
      {
          glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
  
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          graphicEngine.drawTextures(idsTextures);
          glfwSwapBuffers(window);
          glfwPollEvents();
      }
  }
  
  int main()
  {
      Window window;
      if (window.initWindowResources()) {
          window.mainWindowLoop();
      }
  
      return 0;
  }
  </code></pre>
  <p>Png: <a href="https://i.stack.imgur.com/IlbtL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IlbtL.png" alt="" /></a>Size png: 62x34 pixels, Transparent sprite, use prog to created png: piskelapp</p>
  <p>Please, pvoide information about this issue: inforamtion about reasons of this issue and how to fix this issue.</p>