title: Texture does not wrap where expected
body: <p>I am generating a bitmap (1 byte per pixel) and attempting to use it for alpha blending.  I am successfully using the bitmap, but it appears that the texture does not wrap lines as I expect.</p>
  
  <p>When I use the following code, it wraps where I would expect, given the input image.  I get the set of Xs that I expect.</p>
  
  <pre><code>std::ofstream file{ R"(FileName.txt)" };
  
  file &lt;&lt; "width: " &lt;&lt; gs.width() &lt;&lt; "\theight: " &lt;&lt; gs.height() &lt;&lt; "\n";
  
  for (int i = 0; i &lt; gs.height(); ++i)
  {
      for (int j = 0; j &lt; gs.width(); ++j)
      {
          file &lt;&lt; ((gs.alpha()[j + i * gs.width()]) ? 'X' : ' ');
      }
      file &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>When I load the texture it appears that the width of the texture does not match <code>gs.width()</code>, since it wraps oddly.</p>
  
  <p><img src="https://i.stack.imgur.com/AsKdk.png" alt="Output when expecting a lower case &#39;a&#39;."></p>
  
  <p>This is the code that I use to create the texture and load it with the bitmap.</p>
  
  <pre><code>GLuint tex;
  glGenTextures(1, &amp;tex);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, gs.width(), gs.height(), 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, gs.alpha());
  </code></pre>
  
  <p>Can anyone suggest what I might be doing wrong?</p>