title: No texture if multiple textures in modern opengl
body: <p>I'm using C++ and OpenGL 4.6 with SDL2 and glew.
  I have a class Texture:</p>
  
  <pre><code>#include "stb_image/stb_image.h"
  class Texture {
  private:
      unsigned int m_RendererID;
      std::string m_FilePath;
      unsigned char *m_LocalBuffer;
      int m_Width, m_Height, m_BPP;
  public:
      Texture(const std::string &amp;path);
      ~Texture();
  
      void Bind(unsigned int slot = 0) const;
      void Unbind() const;
  
      inline int GetWidth() const { return m_Width; }
      inline int GetHeight() const { return m_Height; }
      inline int GetID() const { return m_RendererID; }
  };
  
  Texture::Texture(const std::string &amp;path) 
      : m_RendererID(0), m_FilePath(path), m_LocalBuffer(nullptr), m_Width(0), m_Height(0), m_BPP(0) 
  {
      stbi_set_flip_vertically_on_load(1); //Flip vertically because OpenGL renders texture in the opposite way
      m_LocalBuffer = stbi_load(path.c_str(), &amp;m_Width, &amp;m_Height, &amp;m_BPP, 4);
  
      GLCall(glGenTextures(1, &amp;m_RendererID));
      GLCall(glBindTexture(GL_TEXTURE_2D, m_RendererID));
  
      GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
      GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
      GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
      GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP));
  
      GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_LocalBuffer));
      GLCall(glBindTexture(GL_TEXTURE_2D, 0));
  
      if (m_LocalBuffer) {
          stbi_image_free(m_LocalBuffer);
      }
  }
  
  Texture::~Texture() {
      GLCall(glDeleteTextures(1, &amp;m_RendererID));
  }
  
  void Texture::Bind(unsigned int slot) const {
      GLCall(glActiveTexture(GL_TEXTURE0 + slot));
      GLCall(glBindTexture(GL_TEXTURE_2D, m_RendererID));
  }
  
  void Texture::Unbind() const {
      GLCall(glBindTexture(GL_TEXTURE_2D, 0));
  }
  </code></pre>
  
  <p>If I create one texture the texture shows:</p>
  
  <pre><code>Texture texture("ship.png");
  texture.Bind(0);
  shader.Bind();
  va.Bind();
  ib.Bind();
  shader.SetUniform1i("u_Texture", 0);
  glDrawElements(GL_TRIANGLES, ib.GetCount(), GL_UNSIGNED_INT, nullptr);
  </code></pre>
  
  <p>But if I create two textures I get only black screen:</p>
  
  <pre><code>Texture texture("ship.png");
  texture.Bind(0);
  Texture texture2("ship2.png");
  texture2.Bind(1);
  shader.Bind();
  va.Bind();
  ib.Bind();
  shader.SetUniform1i("u_Texture", 0);
  glDrawElements(GL_TRIANGLES, ib.GetCount(), GL_UNSIGNED_INT, nullptr);
  </code></pre>
  
  <p>This should work. I was searching on the internet for 2 hours and I can't seem to find the reason as to why this won't work. Could you guys help me out?</p>