From: sgunderson@bigfoot.com <> Date: Sat, 18 Jul 2009 18:15:54 +0000 (+0200) Subject: Make width and height #defines. X-Git-Url: https://git.sesse.net/?p=glcapture;a=commitdiff_plain;h=5a3def119751d78bf9055a679b186026a0adefe6;hp=a6402ef8388be6272df87349f35f5aa1bbe82b4b Make width and height #defines. --- diff --git a/glcapture.c b/glcapture.c index bb4c36e..c67c87d 100644 --- a/glcapture.c +++ b/glcapture.c @@ -18,7 +18,10 @@ #define RTLD_NEXT ((void *) -1l) #endif -static char buf[640 * 480 * 3]; +#define WIDTH 640 +#define HEIGHT 480 + +static char buf[WIDTH * HEIGHT * 3]; static int frameno = 0; void glXSwapBuffers( Display *dpy, GLXDrawable drawable ) @@ -28,12 +31,12 @@ void glXSwapBuffers( Display *dpy, GLXDrawable drawable ) FILE *ppm; char filename[256]; - glReadPixels(0, 0, 640, 480, GL_RGB, GL_UNSIGNED_BYTE, buf); + glReadPixels(0, 0, WIDTH, HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, buf); sprintf(filename, "frame%05u.ppm", frameno++); ppm = fopen(filename, "w"); - fprintf(ppm, "P6\n640 480\n255\n"); - fwrite(buf, 640*480*3, 1, ppm); + fprintf(ppm, "P6\nWIDTH HEIGHT\n255\n"); + fwrite(buf, WIDTH*HEIGHT*3, 1, ppm); fclose(ppm); real_swap(dpy, drawable);