10 static int init(void);
11 static void destroy(void);
12 static void start(long trans_time);
13 static void draw(void);
15 static struct screen scr = {
23 static float cam_theta = -29, cam_phi = 20;
24 static float cam_dist = 6;
26 static struct g3d_mesh torus;
28 struct screen *example_screen(void)
36 if(gen_torus_mesh(&torus, 1.0f, 0.35, 24, 12) == -1) {
42 static void destroy(void)
46 static void start(long trans_time)
48 glEnable(GL_LIGHTING);
52 static void update(void)
56 static void draw(void)
58 float color[4] = {1, 1, 1, 1};
59 float t = (float)time_msec / 10.0f;
63 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
65 glMatrixMode(GL_MODELVIEW);
67 glTranslatef(0, 0, -cam_dist);
68 glRotatef(cam_phi, 1, 0, 0);
69 glRotatef(cam_theta, 0, 1, 0);
73 glTranslatef(0, -1, 0);
78 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
85 glVertex3f(-2, 0, -2);
92 glTranslatef(0, 0.35, 0);
93 glRotatef(t, 0, 1, 0);
94 glRotatef(t, 1, 0, 0);
99 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);