| 12 | #define CHANNELS 4 |
| 13 | |
| 14 | static void check_pixel(const GLubyte *buf, int x, int y, |
| 15 | GLubyte r, GLubyte g, GLubyte b, GLubyte a, |
| 16 | const char *label) { |
| 17 | int i = (y * WIDTH + x) * CHANNELS; |
| 18 | if (buf[i] == r && buf[i+1] == g && buf[i+2] == b && buf[i+3] == a) { |
| 19 | printf("PASS: %s — got rgba(%d,%d,%d,%d)\n", label, r, g, b, a); |
| 20 | } else { |
| 21 | printf("FAIL: %s — expected rgba(%d,%d,%d,%d), got rgba(%d,%d,%d,%d)\n", |
| 22 | label, r, g, b, a, buf[i], buf[i+1], buf[i+2], buf[i+3]); |
| 23 | assert(0); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | static void read_slice(GLuint fb, GLuint tex, int z, GLubyte *out) { |
| 28 | glBindFramebuffer(GL_FRAMEBUFFER, fb); |