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