From 5a3def119751d78bf9055a679b186026a0adefe6 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sat, 18 Jul 2009 20:15:54 +0200 Subject: [PATCH] Make width and height #defines. --- glcapture.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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); -- 2.39.2