Merge commit 'origin/7.8'
[mesa.git] / progs / egl / openvg / lion.c
1 #include <VG/openvg.h>
2 #include <EGL/egl.h>
3
4 #include "lion-render.h"
5 #include "eglut.h"
6
7 static VGint width, height;
8 struct lion *lion = 0;
9 VGfloat angle = 0;
10
11 static void
12 draw(void)
13 {
14 vgClear(0, 0, width, height);
15
16 vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
17 vgLoadIdentity();
18 vgTranslate(width/2, height/2);
19 vgRotate(angle);
20 vgTranslate(-width/2, -height/2);
21
22 lion_render(lion);
23
24 ++angle;
25 eglutPostRedisplay();
26 }
27
28
29 /* new window size or exposure */
30 static void
31 reshape(int w, int h)
32 {
33 width = w;
34 height = h;
35 }
36
37
38 static void
39 init(void)
40 {
41 float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
42 vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
43
44 lion = lion_create();
45 }
46
47
48 int
49 main(int argc, char *argv[])
50 {
51 eglutInitWindowSize(350, 450);
52 eglutInitAPIMask(EGLUT_OPENVG_BIT);
53 eglutInit(argc, argv);
54
55 eglutCreateWindow("Lion Example");
56
57 eglutReshapeFunc(reshape);
58 eglutDisplayFunc(draw);
59
60 init();
61
62 eglutMainLoop();
63
64 return 0;
65 }