28 void record_do(
struct record *s,
const char *name,
int width,
int height,
const char *comment) {
30 s->
bytes = 3 * width * height;
33 glActiveTexture(GL_TEXTURE0 +
TEX_RGB);
34 glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, s->
buffer);
36 FILE *out = fopen(name,
"wb");
42 fprintf(out,
"%s", comment);
43 fprintf(out,
"%d %d\n255\n", width, height);
46 for (
int y = height - 1; y >= 0; --y) {
47 if (1 != fwrite(s->
buffer + y * width * 3, width * 3, 1, out)) {