I’m writing a small program that I’d like to render to an eps file so that I can use the images in latex . However when I render the eps file using the gl2ps library, one of the lines is not drawn. To see what I mean look at the following pictures:
the image I save as viewed from GSview:
and the bitmap image I save:
What troubles me is if for example I rotate the image, gl2ps saves the image just fine. Is there something I miss with gl2ps?
Here is the code I use to save the eps file:
void writefile(int format, int sort, int options, int nbcol,
char *filename, char *extension)
{
FILE *fp;
char file[256];
int state = GL2PS_OVERFLOW, buffsize = 0;
GLint viewport[4];
strcpy(file, filename);
strcat(file, ".");
strcat(file, extension);
viewport[0] = 0;
viewport[1] = 0;
viewport[2] = glutGet(GLUT_WINDOW_WIDTH); //window_w;
viewport[3] = glutGet(GLUT_WINDOW_HEIGHT); //window_h;
fp = fopen(file, "wb");
if(!fp){
printf("Unable to open file %s for writing
", file);
exit(1);
}
printf("Saving image to file %s... ", file);
fflush(stdout);
while(state == GL2PS_OVERFLOW){
buffsize += 1024*1024;
gl2psBeginPage(file, "test", viewport, format, sort, options,
GL_RGBA, 0, NULL, nbcol, nbcol, nbcol,
buffsize, fp, file);
display();
state = gl2psEndPage();
}
fclose(fp);
printf("Done!
");
fflush(stdout);
}
Thanks for your time!