diff options
Diffstat (limited to 'progs/egl/openvg/lion.c')
-rw-r--r-- | progs/egl/openvg/lion.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/progs/egl/openvg/lion.c b/progs/egl/openvg/lion.c new file mode 100644 index 00000000000..c5dba4fcead --- /dev/null +++ b/progs/egl/openvg/lion.c @@ -0,0 +1,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; +} |