#include void init(void) { glClearColor(1.0, 1.0, 1.0, 0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(-400, 400.0, -400.0, 400.0); } void transform(void) { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(0.9, 0.9, 0.9); glRecti(200,-50,300,50); glColor3f(0.6, 0.6, 0.6); glRotatef(90, 0,0,1); glRecti(200,-50,300,50); glLoadIdentity(); glColor3f(0.4,0.4,0.4); glTranslatef(150,0,0); glRotatef(90, 0,0,1); glTranslatef(-150,0,0); glRecti(200,-50,300,50); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(0, 0); glutInitWindowSize(800, 800); glutCreateWindow("An Transform Program"); init(); glutDisplayFunc(transform); glutMainLoop(); return 1; }