Page 62 OpenGL Super Bible! Listing 3-4 Animated bouncing square // bounce.c // Bouncing square #include // Standard windows include #include // OpenGL library #include // AUX library // Initial square position and size GLfloat x1 = 100.0f; GLfloat y1 = 150.0f; GLsizei rsize = 50; // Step size in x and y directions // (number of pixels to move each time) GLfloat xstep = 1.0f; GLfloat ystep = 1.0f; // Keep track of window s changing width and height GLfloat windowWidth; GLfloat windowHeight; // Called by AUX library when the window has changed size void CALLBACK ChangeSize(GLsizei w, GLsizei h) { // Prevent a divide by zero, when window is too short // (you can t make a window of zero width) if(h == 0) h = 1; // Set the viewport to be the entire window glViewport(0, 0, w, h); // Reset the coordinate system before modifying glLoadIdentity(); // Keep the square square, this time, save calculated // width and height for later use if (w <= h) { windowHeight = 250.0f*h/w; windowWidth = 250.0f; } else { windowWidth = 250.0f*w/h; windowHeight = 250.0f; } // Set the clipping volume glOrtho(0.0f, windowWidth, 0.0f, windowHeight, 1.0f, -1.0f); } // Called by AUX library to update window
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services
This entry was posted
on Tuesday, May 1st, 2007 at 12:07 pm and is filed under Coldfusion.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.