viewport.c
/* NOTE: Both the wire cube and the teapot appear elongated in the y-direction
   owing to the difference in the aspect ratio of the viewport (= 1/2) and the
   aspect ratio of the viewing frustum (= 1).*/
Both the wire cube and the teapot appear elongated in the y-direction
owing to the difference in the aspect ratio of the viewport (= 1/2) and the
aspect ratio of the viewing frustum (= 1).
Both the wire cube and the teapot appear elongated in the y - direction owing to the difference in the aspect ratio of the viewport ( = 1 / 2 ) and the aspect ratio of the viewing frustum ( = 1 ) .
void reshape (int w, int h)
{
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity();
   glViewport(0, 0, w, h);
   width = w;
   height = h;
}
void reshape ( int w , int h ) { glMatrixMode ( GL_PROJECTION ) ; glLoadIdentity ( ) ; glFrustum ( -1.0 , 1.0 , -1.0 , 1.0 , 1.5 , 20.0 ) ; glMatrixMode ( GL_MODELVIEW ) ; glLoadIdentity ( ) ; glViewport ( 0 , 0 , w , h ) ; width = w ; height = h ; }
NOTE: Both the wire cube and the teapot appear elongated in the y-direction
owing to the difference in the aspect ratio of the viewport (= 1/2) and the
aspect ratio of the viewing frustum (= 1).
NOTE : Both the wire cube and the teapot appear elongated in the y - direction owing to the difference in the aspect ratio of the viewport ( = 1 / 2 ) and the aspect ratio of the viewing frustum ( = 1 ) .
/* 
 * The following viewport command is needed to clear the background correctly 
 * for both smaller viewports. It is needed because (see red book p. 104)
 * glViewport must be called from within the reshape routine to correctly
 * display the window.
 */