Cube Rotation
#include<stdlib.h>#include<stdio.h>#include<GL/glut.h>#include<math.h>float v[8][3] = { {-1,-1,1},{-1,1,1},{1,1,1},{1,-1,1},{-1,-1,-1},{-1,1,-1},{1,1,-1},{1,-1,-1} };float p[8][3] = { {0,0,1},{0,1,1},{1,1,1},{1,0,1},{0,0,0},{0,1,0},{1,1,0},{1,0,0} };float theta[3] = { 0,0,0 };int flag = 2; void myinit(){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-2, 2, -2, 2, -2, 2); glMatrixMode(GL_MODELVIEW);}void idlefunc(){ theta[flag]++; if (theta[flag] > 360)theta[flag] = 0; glutPostRedisplay();}void mousefunc(int button, int status, int x, int y){ …