r600: don't enable depth test if there is no depth buffer
[mesa.git] / progs / openvg / trivial / coord.c
1 #include "eglcommon.h"
2
3 #include <VG/openvg.h>
4
5 const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
6 const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
7
8 VGPath path;
9 VGPaint fill;
10
11
12 static void
13 init(void)
14 {
15 /* Absent VG_CLOSE_PATH */
16 VGubyte commands[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
17 VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS};
18 VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
19 VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
20 VGfloat coords[] = {-16.0f, -16.0f, 0.0f, -16.0f, 0.0f, 0.0f, -16.0f, 0.0f,
21 0.0f, 0.0f, 16.0f, 0.0f, 16.0f, 16.0f, 0.0f, 16.0f};
22
23 vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
24 vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
25
26 vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
27 vgLoadIdentity();
28 vgTranslate(32.0f, 32.0f);
29
30 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0,
31 VG_PATH_CAPABILITY_ALL);
32 if (path == VG_INVALID_HANDLE)
33 return;
34 fill = vgCreatePaint();
35 if (fill == VG_INVALID_HANDLE) {
36 vgDestroyPath(path);
37 return;
38 }
39 vgAppendPathData(path, 8, commands, coords);
40 vgSetPaint(fill, VG_FILL_PATH);
41 vgSetParameterfv(fill, VG_PAINT_COLOR, 4, fillColor);
42 vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
43 }
44
45 /* new window size or exposure */
46 static void
47 reshape(int w, int h)
48 {
49 }
50
51 static void
52 draw(void)
53 {
54 vgClear(0, 0, window_width(), window_height());
55 vgDrawPath(path, VG_FILL_PATH);
56
57 vgFlush();
58 }
59
60
61 int main(int argc, char **argv)
62 {
63 set_window_size(64, 64);
64 return run(argc, argv, init, reshape,
65 draw, 0);
66 }