8653aa477626d771a783e7c508cd143725bd85d1
[demo_prior] / src / demo.c
1 #include "opengl.h"
2 #include "demo.h"
3
4 int win_width, win_height;
5 long time_msec;
6
7
8 int demo_init(void)
9 {
10         if(init_opengl() == -1) {
11                 return -1;
12         }
13
14         glEnable(GL_DEPTH_TEST);
15         glEnable(GL_CULL_FACE);
16         glEnable(GL_FRAMEBUFFER_SRGB);
17         glEnable(GL_MULTISAMPLE);
18
19         return 0;
20 }
21
22 void demo_cleanup(void)
23 {
24 }
25
26 void demo_display(void)
27 {
28         glClearColor(0.05, 0.05, 0.05, 1);
29         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
30
31         glMatrixMode(GL_MODELVIEW);
32         glLoadIdentity();
33         glTranslatef(0, 0, -8);
34
35         glFrontFace(GL_CW);
36         glutSolidTeapot(1.0);
37         glFrontFace(GL_CCW);
38 }
39
40 void demo_reshape(int x, int y)
41 {
42         glViewport(0, 0, x, y);
43
44         glMatrixMode(GL_PROJECTION);
45         glLoadIdentity();
46         gluPerspective(50.0, (float)x / (float)y, 0.5, 500.0);
47 }
48
49 void demo_keyboard(int key, int st)
50 {
51         if(st) {
52                 switch(key) {
53                 case 27:
54                         demo_quit();
55                         break;
56                 }
57         }
58 }
59
60
61 void demo_mbutton(int bn, int st, int x, int y)
62 {
63 }
64
65 void demo_mmotion(int x, int y)
66 {
67 }
68
69 void demo_sball_motion(int x, int y, int z)
70 {
71 }
72
73 void demo_sball_rotate(int x, int y, int z)
74 {
75 }
76
77 void demo_sball_button(int bn, int st)
78 {
79 }