Bounce.c
// Called by GLUT library when the window has chanaged size

Called by GLUT library when the window has chanaged size
Called by GLUT library when the window has chanaged size
void ChangeSize(GLsizei w, GLsizei h)
        {
        if(h == 0)
                h = 1;
    glViewport(0, 0, w, h);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        if (w <= h) 
                {
                windowHeight = 250.0f*h/w;
                windowWidth = 250.0f;
                }
    else 
                {
                windowWidth = 250.0f*w/h;
                windowHeight = 250.0f;
                }
        glOrtho(0.0f, windowWidth, 0.0f, windowHeight, 1.0f, -1.0f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        }
void ChangeSize ( GLsizei w , GLsizei h ) { if ( h == 0 ) h = 1 ; glViewport ( 0 , 0 , w , h ) ; glMatrixMode ( GL_PROJECTION ) ; glLoadIdentity ( ) ; if ( w <= h ) { windowHeight = 250.0f * h / w ; windowWidth = 250.0f ; } else { windowWidth = 250.0f * w / h ; windowHeight = 250.0f ; } glOrtho ( 0.0f , windowWidth , 0.0f , windowHeight , 1.0f , -1.0f ) ; glMatrixMode ( GL_MODELVIEW ) ; glLoadIdentity ( ) ; }
Called by GLUT library when the window has chanaged size
Called by GLUT library when the window has chanaged size
// Prevent a divide by zero
 // Set Viewport to window dimensions
 // Reset coordinate system
 // Keep the square square, this time, save calculated
 // width and height for later use
 // Set the clipping volume
