Added a touch of error checking to the screen dump routine, i.e. don't

die if you can't open the output file.
This commit is contained in:
curt
2000-09-09 13:31:45 +00:00
parent 502c650cd9
commit b0134a377e

View File

@@ -50,7 +50,11 @@ void my_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int
ibuffer = (unsigned char *) malloc(win_width*win_height*RGB);
fp = fopen(filename, "wb");
if ( (fp = fopen(filename, "wb")) == NULL ) {
printf("Warning: cannot open %s\n", filename);
return;
}
fprintf(fp, "P6\n# CREATOR: glReadPixel()\n%d %d\n%d\n",
win_width, win_height, UCHAR_MAX);
q = 0;