title: OpenGL,C++, Why is the glutReshapeFunc function giving a black opengl screen?
body: <p>I have been following an opengl tutorial, but for some reason when i added the reshape function(for window resize to fix ratio). the opengl window doesnt show the object(shape) at all, just a black screen.
  i dont know if i made a misspelling or something. </p>
  
  <p>Is the reshape function messing things up? </p>
  
  <pre><code>#include &lt;GL/gl.h&gt;
  #include &lt;GL/glut.h&gt;
  
  void renderScene(void);
  void changeSize(int w, int h);
  
  int main(int argc, char **argv){
  
  // init GLUT and create window
  glutInit(&amp;argc, argv);
  glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
  glutInitWindowPosition(100,100);
  glutInitWindowSize(320,320);
  glutCreateWindow("Testing");
  
  // register callbacks
  glutDisplayFunc(renderScene);
  
  // animation in reshaping
  glutReshapeFunc(changeSize);
  
  // enter GLUT event processing cycle
  glutMainLoop();
  
  return 1;
  }
  
  void renderScene(void){
  
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  glBegin(GL_TRIANGLES);
      glVertex3f(-0.5,-0.5,0.0);
      glVertex3f(0.5,0.0,0.0);
      glVertex3f(0.0,0.5,0.0);
  glEnd();
  
  glutSwapBuffers();
  }
  
  void changeSize(int w, int h){
  
  if (h==0)
      h = 1;
  float ratio = 1.0*w/h;
  
  // use the projection matrix
  glMatrixMode(GL_PROJECTION);
  
  //reset matrix
  glLoadIdentity();
  
  // set the viewpoint to be the entire window
  glViewport(0,0,w,h);
  
  // set the correct perspective
  gluPerspective(45, ratio, 1, 1000);
  
  // get back to the modelview
  glMatrixMode(GL_MODELVIEW);
  }
  </code></pre>
  
  <p>Thanks for any help!
  This is from the Lighthouse3d tutorials.</p>
  
  <p>PS: if i take out the reshape function, the triangle shows up(works fine).</p>