title: How do I fill the screen with a rectangle in OpenGL ortho mode?
body: <p>I have a single 640x480 texture that needs to fill the screen. So far, I can make it work with a square texture, but not a rectangular one.</p>
  
  <pre><code>glViewport(0, 0, display-&gt;w, display-&gt;h);
  
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  
  double aspectRatio = (double)display-&gt;w / (double)display-&gt;h;
  
  if (display-&gt;w &lt;= display-&gt;h)
      glOrtho(-1, 1, -1 / aspectRatio, 1 / aspectRatio, -1, 1);
  else
      glOrtho(-1 * aspectRatio, 1 * aspectRatio, -1, 1, -1, 1);
  
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  </code></pre>
  
  <p>What modifications do I need to make so that it will fit any texture to the screen, regardless of its aspect ratio?</p>