* Draws the gears. */
| 514 | * Draws the gears. |
| 515 | */ |
| 516 | static void |
| 517 | gears_draw(void) |
| 518 | { |
| 519 | const static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; |
| 520 | const static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; |
| 521 | const static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; |
| 522 | GLfloat transform[16]; |
| 523 | identity(transform); |
| 524 | |
| 525 | glClearColor(0.0, 0.0, 0.0, 0.0); |
| 526 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 527 | |
| 528 | /* Translate and rotate the view */ |
| 529 | translate(transform, 0, 0, -20); |
| 530 | rotate(transform, 2 * M_PI * view_rot[0] / 360.0, 1, 0, 0); |
| 531 | rotate(transform, 2 * M_PI * view_rot[1] / 360.0, 0, 1, 0); |
| 532 | rotate(transform, 2 * M_PI * view_rot[2] / 360.0, 0, 0, 1); |
| 533 | |
| 534 | /* Draw the gears */ |
| 535 | draw_gear(gear1, transform, -3.0, -2.0, angle, red); |
| 536 | draw_gear(gear2, transform, 3.1, -2.0, -2 * angle - 9.0, green); |
| 537 | draw_gear(gear3, transform, -3.1, 4.2, -2 * angle - 25.0, blue); |
| 538 | |
| 539 | glutSwapBuffers(); |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * Handles a new window size or exposure. |