r600: don't enable depth test if there is no depth buffer
[mesa.git] / progs / openvg / trivial / lineto.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 static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
16 static const VGfloat sqrCoords[5] = {50.0f, 50.0f, 250.0f, 250.0f, 50.0f};
17 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
18 VG_PATH_CAPABILITY_APPEND_TO);
19 vgAppendPathData(path, 5, sqrCmds, sqrCoords);
20
21 fill = vgCreatePaint();
22 vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
23 vgSetPaint(fill, VG_FILL_PATH);
24
25 vgSetfv(VG_CLEAR_COLOR, 4, white_color);
26 vgSetf(VG_STROKE_LINE_WIDTH, 10);
27 vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
28 vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
29 vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
30 }
31
32 /* new window size or exposure */
33 static void
34 reshape(int w, int h)
35 {
36 vgLoadIdentity();
37 }
38
39 static void
40 draw(void)
41 {
42 vgClear(0, 0, window_width(), window_height());
43 vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER);
44 vgLoadIdentity();
45 vgScale(2.25, 2.25);
46 vgDrawPath(path, VG_STROKE_PATH);
47
48 vgFlush();
49 }
50
51
52 int main(int argc, char **argv)
53 {
54 return run(argc, argv, init, reshape,
55 draw, 0);
56 }