title: Resizing an OpenGL window causes it to fall apart
body: <p>For some reason when I resize my OpenGL windows, everything falls apart. The image is distorted, the coordinates don't work, and everything simply falls apart. I am sing Glut to set it up. </p>
  
  <pre><code>//Code to setup glut
  glutInitWindowSize(appWidth, appHeight);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
  glutCreateWindow("Test Window");
  
  //In drawing function
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glClear(GL_COLOR_BUFFER_BIT);
  
  //Resize function
  void resize(int w, int h)
  {
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluOrtho2D(0, w, h, 0);
  }
  </code></pre>
  
  <p>The OpenGL application is strictly 2D. </p>
  
  <p>This is how it looks like initially: <a href="http://www.picgarage.net/images/Corre_53880_651.jpeg" rel="nofollow noreferrer">http://www.picgarage.net/images/Corre_53880_651.jpeg</a></p>
  
  <p>this is how it looks like after resizing: <a href="http://www.picgarage.net/images/wrong_53885_268.jpeg" rel="nofollow noreferrer">http://www.picgarage.net/images/wrong_53885_268.jpeg</a></p>