#include <windows.h> // Standard Window header required for all programs
#include <stdio.h>
#include <GL\gl.h> // OpenGL functions
#include <GL\glaux.h> // AUX Library functions
#include <iostream>
// Initial square position and size
GLfloat x = 100.0f;
GLfloat y = 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(-windowWidth/2, windowWidth/2, -windowHeight/2, windowHeight/2, 1.0f, -1.0f);
}
// Called by AUX library to draw scene
void CALLBACK RenderScene(void)
{
// Set background clearing color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set drawing color to red, and draw rectangle at
// current position.
glColor3f(1.0f, 0.0f, 0.0f);
//glRectf(x, y, x +
aux程序#include <windows.h> // Standard Window header required for all programs#include <stdio.h>#include <GL\gl.h> // OpenGL functions #include <GL\glaux.h> // AUX L...