hey
i have this code to save an image rendered by opngl,but iam confused,how can i pass the name of the file “in which formay”
and wht to invoke in main “tgaGrabScreenSeries()” or “tgaSaveSeries()”??plz help me
// takes a screen shot and saves it to a TGA image
int tgaGrabScreenSeries(char *filename, int xmin,int ymin, int xmax, int ymax) {
int w, h;
unsigned char *imageData;
// compute width and heidth of the image
w = xmax - xmin;
h = ymax - ymin;
// allocate memory for the pixels
imageData = (unsigned char *)malloc(sizeof(unsigned char) * w * h * 4);
// read the pixels from the frame buffer
glReadPixels(xmin,ymin,xmax,ymax,GL_RGBA,GL_UNSIGNED_BYTE, (GLvoid *)imageData);
// save the image
return(tgaSaveSeries(filename,w,h,32,imageData));
}
// saves an array of pixels as a TGA image
int tgaSave( char *filename,
short int width,
short int height,
unsigned char pixelDepth,
unsigned char *imageData) {
unsigned char cGarbage = 0, type,mode,aux;
short int iGarbage = 0;
int i;
FILE *file;