10 float red_color
[4] = {1.0, 0.0, 0.0, 1.0};
11 float blue_color
[4] = {0.0, 0.0, 1.0, 1.0};
17 data
= malloc(sizeof(VGint
)*2048*2048);
20 /* new window size or exposure */
30 static const VGint red_pixel
= 255 << 24 | 255 << 16 | 0 << 8 | 0;
31 static const VGint blue_pixel
= 255 << 24 | 0 << 16 | 0 << 8 | 255;
34 vgSetfv(VG_CLEAR_COLOR
, 4, red_color
);
35 vgClear(0, 0, window_width(), window_height());
38 memset(data
, 0, window_width() * window_height() * sizeof(VGint
));
40 vgReadPixels(data
, window_width() * sizeof(VGint
),
42 0, 0, window_width(), window_height());
44 fprintf(stderr
, "Red 0 = 0x%x and at 600 = 0x%x\n",
46 for (i
= 0; i
< window_width() * window_height(); ++i
) {
47 assert(data
[i
] == red_pixel
);
50 vgSetfv(VG_CLEAR_COLOR
, 4, blue_color
);
51 vgClear(50, 50, 50, 50);
54 memset(data
, 0, window_width() * window_height() * sizeof(VGint
));
56 vgReadPixels(data
, 50 * sizeof(VGint
),
60 fprintf(stderr
, "Blue 0 = 0x%x and at 100 = 0x%x\n",
62 for (i
= 0; i
< 50 * 50; ++i
) {
63 assert(data
[i
] == blue_pixel
);
68 int main(int argc
, char **argv
)
70 int ret
= run(argc
, argv
, init
, reshape
,