11 static const int FPS = 20;
22 glRotatef(-90.0, 1.0, 0.0, 0.0);
23 glutWireSphere(radius, slices, stacks);
41 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
45 glColor3f(1.0, 1.0, 0.0);
50 glRotatef((GLfloat)
year, 0.0, 1.0, 0.0);
51 glTranslatef(2.0, 0.0, 0.0);
52 glRotatef((GLfloat)
day, 0.0, 1.0, 0.0);
53 glColor3f(0.0, 0.0, 1.0);
57 glVertex3f(0, -0.3, 0);
58 glVertex3f(0, 0.3, 0);
72 static GLfloat
u = 0.0;
73 static GLfloat
du = 0.1;
80 gluLookAt(20 * cos(
u / 8.0) + 12,
82 10 * cos(
u / 8.0) + 2,
90 glutTimerFunc(1000 / 60,
timer, v);
104 glViewport(0, 0, w, h);
105 glMatrixMode(GL_PROJECTION);
107 gluPerspective(60.0, (GLfloat)w / (GLfloat)h, 1.0, 40.0);
108 glMatrixMode(GL_MODELVIEW);
112 int main(
int argc,
char **argv) {
113 glutInit(&argc, argv);
114 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
115 glutInitWindowSize(800, 600);
116 glutCreateWindow(
"Comet, Planet Simulation");
119 glutTimerFunc(100,
timer, 0);
120 glEnable(GL_DEPTH_TEST);
void reshape(GLint w, GLint h)
static GLfloat current_rot
int main(int argc, char **argv)
void myWireSphere(GLfloat radius, int slices, int stacks)