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