r600: don't enable depth test if there is no depth buffer
[mesa.git] / progs / openvg / trivial / lookup.c
1 #include "eglcommon.h"
2
3 #include <VG/openvg.h>
4
5 #include <math.h>
6 #include <stdlib.h>
7 #include <stdio.h>
8
9 const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
10 const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
11 VGfloat clearColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
12 VGImage parent;
13
14 VGPaint fill;
15
16 static void
17 init(void)
18 {
19 VGImage child1, child2;
20 VGubyte *data;
21 VGuint LUT[256];
22 VGint i;
23
24 data = (VGubyte *)malloc(sizeof(VGubyte)*window_width()*window_height());
25
26 for (i=0;i<window_width()*window_height();i++) {
27 data[i] = 0x00;
28 }
29
30 for (i=0; i<256; i++) {
31 if ( i == 0 )
32 LUT[0] = 0xFFFFFFFF;
33 else
34 LUT[i] = 0xFF00FFFF;
35 }
36
37 parent = vgCreateImage( VG_A_8, 64, 64, VG_IMAGE_QUALITY_NONANTIALIASED );
38
39 vgImageSubData(parent, data, window_width(), VG_A_8, 0, 0,
40 window_width(), window_height());
41 child1 = vgChildImage(parent, 0, 0, 32, 64);
42 child2 = vgChildImage(parent, 32, 0, 32, 64);
43
44 vgLookupSingle(child2, child1, LUT, VG_GREEN, VG_FALSE, VG_TRUE);
45 }
46
47 /* new window size or exposure */
48 static void
49 reshape(int w, int h)
50 {
51 }
52
53 static void
54 draw(void)
55 {
56 vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
57 vgClear(0, 0, window_width(), window_height());
58 //vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
59 //vgLoadIdentity();
60 //vgTranslate(10, 10);
61 vgDrawImage(parent);
62 vgFlush();
63 }
64
65
66 int main(int argc, char **argv)
67 {
68 set_window_size(64, 64);
69 return run(argc, argv, init, reshape,
70 draw, 0);
71 }