OpenGL Rotating Cube Code
#include<GL/glut.h> #include<iostream> #include<dos.h> #include<time.h> using namespace std; GLfloat angle = 0.0; void spin(void) { angle = angle + 0.1; glutPostRedisplay(); } void display(void) { glClearColor(1,1,0,10); glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); gluLookAt(0.0, 0.0, 10, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glRotatef(angle,1,0,0); //glRotatef(angle, 0, 1, 0); //glRotatef(angle,0, 0, 1); glColor3d(1.0, 0.0, 0.0); glutWireCube(6.0); glColor3d(1.0, 0.0, 0.0); glutWireCube(5.0); glColor3d(0, 1.0, 0.0); glutWireCube(4.0); glColor3d(0, 1.0, 0.0); glutWireCube(3.0); glColor3d(0, 0.0, 1.0); glutWireCube(2.0); glColor3d(0, 0.0, 1.0); glutWireCube(1.0); glutWireCube(1.0); glColor3d(1, 1, 1.0); glFlush(); } void keyboard(unsigned char key, int x, int y) { if (key == 27) exit(0); } void reshape(int width, int height) { glViewport(0, 0, (GLsizei)width, (GLsizei)hei