   when does polygon change its size ?
  i have wrote two procedure, which only differs in reshape function. to my surprise the first polygon changes its size while we change the window's size,while the other doesn't. the reshape function as follows:**************the first one**************************void reshape(int w, int h){   glViewport (0, 0, (GLsizei) w, (GLsizei) h);   glMatrixMode(GL_PROJECTION);   glLoadIdentity();   glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);   glMatrixMode(GL_MODELVIEW);   glLoadIdentity();}**********************the second one**********************void reshape (int w, int h){   glViewport (0, 0, (GLsizei) w, (GLsizei) h);   glMatrixMode (GL_PROJECTION);   glLoadIdentity();   if (w <= h) glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,    1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);   else glOrtho (-1.5*(GLfloat)w/(GLfloat)h,    1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);   glMatrixMode(GL_MODELVIEW);   glLoadIdentity();}   
  Why does this surprise you?The first method basically says the left side of the window is -50 and the right side is +50, so a point plotted with an x-coordinate of -25 will always be 25% in from the left side of the window; if you resize the window the point will have to move to stay at the 25% position.In the second method you appear to be calculating the aspect ratio of the window and adjusting the clip-planes so that if the window resizes then points will appear to stay at an absolute position because the scale of units between the sides of the window changes accordingly.Imagine we're both holding a strip of rubber band and a piece of string.  They both have an ink mark 30% of the way along them.  If we now stretch out this rubber then the ink mark will still be 30% along the strip but it will no longer match up with the non-stretched mark on the piece of sting, it's a similar principle with your first method, the rubber band represents the window and the string represents your screen (your screen doesn't change size but the window does), now when you resize the window the points inside it stay the same relative to the window but change position relative to your screen.With the second method it would be like you constantly re-drawing (re-calculating) the position of the ink mark on the rubber band so that it always matches up with the one on the piece of string.  So now the point moves relative to the window (the rubber band) but stays the same relative to the screen (the string) making it appear to stay still.   ;Quote:Original post by dmatterWhy does this surprise you?The first method basically says the left side of the window is -50 and the right side is +50, so a point plotted with an x-coordinate of -25 will always be 25% in from the left side of the window; if you resize the window the point will have to move to stay at the 25% position.In the second method you appear to be calculating the aspect ratio of the window and adjusting the clip-planes so that if the window resizes then points will appear to stay at an absolute position because the scale of units between the sides of the window changes accordingly.Imagine we're both holding a strip of rubber band and a piece of string.  They both have an ink mark 30% of the way along them.  If we now stretch out this rubber then the ink mark will still be 30% along the strip but it will no longer match up with the non-stretched mark on the piece of sting, it's a similar principle with your first method, the rubber band represents the window and the string represents your screen (your screen doesn't change size but the window does), now when you resize the window the points inside it stay the same relative to the window but change position relative to your screen.With the second method it would be like you constantly re-drawing (re-calculating) the position of the ink mark on the rubber band so that it always matches up with the one on the piece of string.  So now the point moves relative to the window (the rubber band) but stays the same relative to the screen (the string) making it appear to stay still.thank you very much,maybe i need know about the priciple of the transform first. thank you for your detailed explanation!