title: Draw GL_TEXTURE_RECTANGLE vs. GL_TEXTURE_2D
body: <p>I'm trying to make a function to draw both 2D textures and Rectangle Textures.</p>
  
  <p>It draws the 2D ones perfectly fine. However, when drawing any Rectangle textures, it draws them completely white..</p>
  
  <pre><code>GLuint LoadImage(std::string ImageTitle, GLenum Target)
  {
      Image Img(("Images/" + ImageTitle).c_str());
      std::vector&lt;std::uint8_t&gt; Buffer;
      ImageToBuffer(Buffer, Img);
  
      GLuint ID;
      glGenTextures(1, &amp;ID);
      glBindTexture(Target, ID);
      glTexParameteri(Target, GL_TEXTURE_WRAP_S, Target == GL_TEXTURE_2D ? GL_REPEAT : GL_CLAMP_TO_EDGE);
      glTexParameteri(Target, GL_TEXTURE_WRAP_T, Target == GL_TEXTURE_2D ? GL_REPEAT : GL_CLAMP_TO_EDGE);
      glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glTexImage2D(Target, 0, GL_RGB, Img.Width(), Img.Height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, Buffer.data());
      return ID;
  }
  
  void DrawTexture(GLenum Target, GLuint ID, float X1, float Y1, float X2, float Y2)
  {
      GLfloat ViewPort[4];
      glGetFloatv(GL_VIEWPORT, ViewPort);
  
      glEnable(Target);
      glBindTexture(Target, ID);
      glBegin(GL_QUADS);
          glTexCoord2f(0, 0);
          glVertex2f(X1, Y1);
  
          glTexCoord2f(0, Target == GL_TEXTURE_2D ? 1 : ViewPort[3]);
          glVertex2f(X1, Y2);
  
          glTexCoord2f(Target == GL_TEXTURE_2D ? 1 : ViewPort[2], Target == GL_TEXTURE_2D ? 1 : ViewPort[3]);
          glVertex2f(X2, Y2);
  
          glTexCoord2f(Target == GL_TEXTURE_2D ? 1 : ViewPort[2], 0);
          glVertex2f(X2, Y1);
      glEnd();
      glDisable(Target);
  }
  </code></pre>
  
  <p>I also tried using <code>glTextCoordf(X, Y)</code> where X and Y are 1 instead of ViewPort Width/Height. Tried using the Width/Height, still nothing. Tried Texture Width and Height. I tried loading the Rect as a 2D as well. No luck.</p>
  
  <p>Nothing works :S Yet it somehow works for Texture2D.</p>
  
  <p>I use it like:</p>
  
  <pre><code>GLuint ID = LoadImage("RECT_116.png", GL_TEXTURE_RECTANGLE);
  
  //Do other stuff here..
  
  DrawTexture(GL_TEXTURE_RECTANGLE, ID, X1, Y1, X2, Y2);
  </code></pre>
  
  <p>and it fails but when I do it on a 2D Texture:</p>
  
  <pre><code>GLuint ID = LoadImage("2D_116.png", GL_TEXTURE_2D);
  
  //Do other stuff here..
  
  DrawTexture(GL_TEXTURE_2D, ID, X1, Y1, X2, Y2);
  </code></pre>
  
  <p>it works..  Any ideas what I'm doing wrong?</p>