title: Aspect Ratio Stretching in OpenGL
body: <p>I am having some trouble with full screen mode. I can set my window to be 800x600, but when I full screen that resolution, it stretches. I assume this is because of a change in aspect ratio. How can I fix this?</p>
  
  <p>Edit #1</p>
  
  <p>Here's a screen shot of what I see happening.</p>
  
  <p><a href="https://i.stack.imgur.com/0pcx1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0pcx1.png" alt="image"></a></p>
  
  <p>Left: 800x600</p>
  
  <p>Right: 1366x768</p>
  
  <p>Edit #2</p>
  
  <p>My initGraphics function gets called every time I re-size the window (WM_SIZE).</p>
  
  <pre><code>void initGraphics(int width, int height) {
      float aspect = (float)width / (float)height;
      glViewport(0, 0, width, height);
      glEnable(GL_TEXTURE_2D);
      glEnable(GL_BLEND); //Enable alpha blending
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glClearColor(0.0, 0.0, 0.0, 1.0);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluOrtho2D(0.0, width, height * aspect, 0.0);
      glMatrixMode(GL_MODELVIEW);
  }
  </code></pre>