68068b8ebe0f46e5533f6b2acd262ba111cc0bce
[andemo] / src / demo.c
1 #include "demo.h"
2 #include "opengl.h"
3 #include "sanegl.h"
4 #include "assman.h"
5
6 static unsigned int sdr_foo;
7 static unsigned int tex_logo;
8
9 int demo_init(void)
10 {
11         if(init_opengl() == -1) {
12                 return -1;
13         }
14
15         if(!(sdr_foo = get_sdrprog("sdr/foo.v.glsl", "sdr/foo.p.glsl"))) {
16                 return -1;
17         }
18         if(!(tex_logo = get_tex2d("data/ml_logo_old.png"))) {
19                 return -1;
20         }
21         return 0;
22 }
23
24 void demo_cleanup(void)
25 {
26 }
27
28 void demo_display(void)
29 {
30         glClear(GL_COLOR_BUFFER_BIT);
31
32         glUseProgram(sdr_foo);
33         gl_begin(GL_QUADS);
34         gl_texcoord2f(0, 1);
35         gl_vertex2f(-1, -1);
36         gl_texcoord2f(1, 1);
37         gl_vertex2f(1, -1);
38         gl_texcoord2f(1, 0);
39         gl_vertex2f(1, 1);
40         gl_texcoord2f(0, 0);
41         gl_vertex2f(-1, 1);
42         gl_end();
43 }
44
45 void demo_reshape(int x, int y)
46 {
47         glViewport(0, 0, x, y);
48 }
49
50 void demo_keyboard(int key, int pressed)
51 {
52 }
53
54 void demo_mouse(int bn, int pressed, int x, int y)
55 {
56 }
57
58 void demo_motion(int x, int y)
59 {
60 }