-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscene.cpp
More file actions
35 lines (26 loc) · 717 Bytes
/
scene.cpp
File metadata and controls
35 lines (26 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <GL/glut.h>
#include "scene.h"
void DrawScene(float angle){
/* Draw objects */
// base
glPushMatrix();
glColor3f(0.4f, 0.3f, 0.3f);
glTranslatef(0.0f, 0.0f, 1.0f);
glScalef(0.95f, 0.05f, 0.95f);
glutSolidCube(5.0f);
glPopMatrix();
glPushMatrix();
// red torus
glColor3f(1.0f, 0.3f, 0.3f);
glTranslatef(0.0f, 1.0f, 0.0f);
glRotatef(angle, 0.0f, 1.0f, 1.0f);
glPushMatrix();
glutSolidTorus(0.1, 0.3, 50, 50);
glPopMatrix();
// yellow torus
glRotatef(angle + 60, 1.0f, 0.0f, 0.0f);
glColor3f(1.2f, 0.8f, 0.4f);
glutSolidTorus(0.05, 0.13, 50, 50);
glPopMatrix();
glPopMatrix();
}