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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user