diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp index 587053c45e8d80dbd6010280ea39b2ea29f10360..3c134ea7761440ded8694ae9fe7cacc9688e9b9c 100644 --- a/Graphics/gl2ps.cpp +++ b/Graphics/gl2ps.cpp @@ -1,8 +1,8 @@ /* * GL2PS, an OpenGL to PostScript Printing Library - * Copyright (C) 1999-2003 Christophe Geuzaine + * Copyright (C) 1999-2003 Christophe Geuzaine * - * $Id: gl2ps.cpp,v 1.64 2003-04-14 22:55:56 geuzaine Exp $ + * $Id: gl2ps.cpp,v 1.65 2003-06-02 18:26:22 geuzaine Exp $ * * E-mail: geuz@geuz.org * URL: http://www.geuz.org/gl2ps/ @@ -21,6 +21,20 @@ * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * Contributor(s): + * Michael Sweet <mike@easysw.com> + * Marc Ume <marc.ume@digitalgraphics.be> + * Jean-Francois Remacle <remacle@scorec.rpi.edu> + * Bart Kaptein <B.L.Kaptein@lumc.nl> + * Quy Nguyen-Dai<quy@vnilux.com> + * Sam Buss <sbuss@ucsd.edu> + * Shane Hill <Shane.Hill@dsto.defence.gov.au> + * Romain Boman <r_boman@yahoo.fr> + * Rouben Rostamian <rostamian@umbc.edu> + * Diego Santa Cruz <Diego.SantaCruz@epfl.ch> + * Shahzad Muzaffar <Shahzad.Muzaffar@cern.ch> + * Lassi Tuura <lassi.tuura@cern.ch> + * Guy Barrand <barrand@lal.in2p3.fr> */ #include <string.h> @@ -1467,7 +1481,7 @@ void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GLsizei width, GLsizei hei } if(status == 0){ - gl2psMsg(GL2PS_ERROR, "Problem to retreive some pixel rgb"); + gl2psMsg(GL2PS_ERROR, "Problem to retrieve some pixel rgb"); } fprintf(stream, "grestore\n"); } @@ -1488,13 +1502,14 @@ void gl2psPrintPostScriptHeader(void){ fprintf(gl2ps->stream, "%%%%Title: %s\n" - "%%%%Creator: GL2PS, an OpenGL to PostScript Printing Library, v. %g\n" + "%%%%Creator: GL2PS %d.%d.%d, an OpenGL to PostScript Printing Library\n" "%%%%For: %s\n" "%%%%CreationDate: %s" "%%%%LanguageLevel: 3\n" "%%%%DocumentData: Clean7Bit\n" "%%%%Pages: 1\n", - gl2ps->title, GL2PS_VERSION, gl2ps->producer, ctime(&now)); + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, + gl2ps->producer, ctime(&now)); if(gl2ps->format == GL2PS_PS){ fprintf(gl2ps->stream, @@ -1735,7 +1750,7 @@ void gl2psPrintPostScriptPrimitive(void *a, void *b){ if(prim->dash){ fprintf(gl2ps->stream, "[%d] 0 setdash\n", prim->dash); } - if(gl2ps->shade && !gl2psVertsSameColor(prim)){ + if(!gl2psVertsSameColor(prim)){ gl2psResetPostScriptColor(); fprintf(gl2ps->stream, "%g %g %g %g %g %g %g %g %g %g SL\n", prim->verts[1].xyz[0], prim->verts[1].xyz[1], @@ -1755,7 +1770,7 @@ void gl2psPrintPostScriptPrimitive(void *a, void *b){ } break; case GL2PS_TRIANGLE : - if(gl2ps->shade && !gl2psVertsSameColor(prim)){ + if(!gl2psVertsSameColor(prim)){ gl2psResetPostScriptColor(); fprintf(gl2ps->stream, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n", prim->verts[2].xyz[0], prim->verts[2].xyz[1], @@ -1902,12 +1917,9 @@ GLint gl2psPrintTeXEndViewport(void){ GLint gl2psPrintPrimitives(void){ GL2PSbsptree *root; GL2PSxyz eye = {0., 0., 100000.}; - GLint shademodel, res = GL2PS_SUCCESS; + GLint res = GL2PS_SUCCESS; void (*pprim)(void *a, void *b) = 0; - glGetIntegerv(GL_SHADE_MODEL, &shademodel); - gl2ps->shade = (shademodel == GL_SMOOTH); - if(gl2ps->format == GL2PS_PS || gl2ps->format == GL2PS_EPS){ res = gl2psParseFeedbackBuffer(); } diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h index 355c946f91acd302fb0d685a13d251ac29ba51d3..67624ef16c055febd42eaed98ed7b15810bae79f 100644 --- a/Graphics/gl2ps.h +++ b/Graphics/gl2ps.h @@ -1,8 +1,8 @@ /* * GL2PS, an OpenGL to PostScript Printing Library - * Copyright (C) 1999-2003 Christophe Geuzaine + * Copyright (C) 1999-2003 Christophe Geuzaine * - * $Id: gl2ps.h,v 1.38 2003-03-10 16:21:38 geuzaine Exp $ + * $Id: gl2ps.h,v 1.39 2003-06-02 18:26:22 geuzaine Exp $ * * E-mail: geuz@geuz.org * URL: http://www.geuz.org/gl2ps/ @@ -30,8 +30,7 @@ #include <stdlib.h> #include <math.h> -/* To generate a Windows dll, you have to define GL2PSDLL at compile - time */ +/* To generate a Windows dll, define GL2PSDLL at compile time */ #ifdef WIN32 # include <windows.h> @@ -54,91 +53,97 @@ # include <GL/gl.h> #endif +/* Version number */ -#define GL2PS_VERSION 0.8 -#define GL2PS_NONE 0 +#define GL2PS_MAJOR_VERSION 0 +#define GL2PS_MINOR_VERSION 9 +#define GL2PS_PATCH_VERSION 0 + +#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ + 0.01 * GL2PS_MINOR_VERSION + \ + 0.0001 * GL2PS_PATCH_VERSION) /* Output file format */ -#define GL2PS_PS 1 -#define GL2PS_EPS 2 -#define GL2PS_TEX 3 +#define GL2PS_PS 1 +#define GL2PS_EPS 2 +#define GL2PS_TEX 3 /* Sorting algorithms */ -#define GL2PS_NO_SORT 1 -#define GL2PS_SIMPLE_SORT 2 -#define GL2PS_BSP_SORT 3 +#define GL2PS_NO_SORT 1 +#define GL2PS_SIMPLE_SORT 2 +#define GL2PS_BSP_SORT 3 /* Options for gl2psBeginPage */ -#define GL2PS_DRAW_BACKGROUND (1<<0) -#define GL2PS_SIMPLE_LINE_OFFSET (1<<1) -#define GL2PS_SILENT (1<<2) -#define GL2PS_BEST_ROOT (1<<3) -#define GL2PS_OCCLUSION_CULL (1<<4) -#define GL2PS_NO_TEXT (1<<5) -#define GL2PS_LANDSCAPE (1<<6) -#define GL2PS_NO_PS3_SHADING (1<<7) -#define GL2PS_NO_PIXMAP (1<<8) +#define GL2PS_NONE 0 +#define GL2PS_DRAW_BACKGROUND (1<<0) +#define GL2PS_SIMPLE_LINE_OFFSET (1<<1) +#define GL2PS_SILENT (1<<2) +#define GL2PS_BEST_ROOT (1<<3) +#define GL2PS_OCCLUSION_CULL (1<<4) +#define GL2PS_NO_TEXT (1<<5) +#define GL2PS_LANDSCAPE (1<<6) +#define GL2PS_NO_PS3_SHADING (1<<7) +#define GL2PS_NO_PIXMAP (1<<8) /* Arguments for gl2psEnable/gl2psDisable */ -#define GL2PS_POLYGON_OFFSET_FILL 1 -#define GL2PS_POLYGON_BOUNDARY 2 -#define GL2PS_LINE_STIPPLE 3 +#define GL2PS_POLYGON_OFFSET_FILL 1 +#define GL2PS_POLYGON_BOUNDARY 2 +#define GL2PS_LINE_STIPPLE 3 /* Magic numbers */ -#define GL2PS_EPSILON 5.e-3 -#define GL2PS_DEPTH_FACT 1000.0 -#define GL2PS_SIMPLE_OFFSET 0.05 -#define GL2PS_SIMPLE_OFFSET_LARGE 1.0 -#define GL2PS_ZERO(arg) (fabs(arg)<1.e-20) -/*#define GL2PS_ZERO(arg) ((arg)==0.0)*/ +#define GL2PS_EPSILON 5.e-3 +#define GL2PS_DEPTH_FACT 1000.0 +#define GL2PS_SIMPLE_OFFSET 0.05 +#define GL2PS_SIMPLE_OFFSET_LARGE 1.0 +#define GL2PS_ZERO(arg) (fabs(arg)<1.e-20) /* Message levels and error codes */ -#define GL2PS_SUCCESS 0 -#define GL2PS_INFO 1 -#define GL2PS_WARNING 2 -#define GL2PS_ERROR 3 -#define GL2PS_NO_FEEDBACK 4 -#define GL2PS_OVERFLOW 5 -#define GL2PS_UNINITIALIZED 6 +#define GL2PS_SUCCESS 0 +#define GL2PS_INFO 1 +#define GL2PS_WARNING 2 +#define GL2PS_ERROR 3 +#define GL2PS_NO_FEEDBACK 4 +#define GL2PS_OVERFLOW 5 +#define GL2PS_UNINITIALIZED 6 /* Primitive types */ -#define GL2PS_TEXT 1 -#define GL2PS_POINT 2 -#define GL2PS_LINE 3 -#define GL2PS_QUADRANGLE 4 -#define GL2PS_TRIANGLE 5 -#define GL2PS_PIXMAP 6 +#define GL2PS_TEXT 1 +#define GL2PS_POINT 2 +#define GL2PS_LINE 3 +#define GL2PS_QUADRANGLE 4 +#define GL2PS_TRIANGLE 5 +#define GL2PS_PIXMAP 6 /* BSP tree primitive comparison */ -#define GL2PS_COINCIDENT 1 -#define GL2PS_IN_FRONT_OF 2 -#define GL2PS_IN_BACK_OF 3 -#define GL2PS_SPANNING 4 +#define GL2PS_COINCIDENT 1 +#define GL2PS_IN_FRONT_OF 2 +#define GL2PS_IN_BACK_OF 3 +#define GL2PS_SPANNING 4 /* 2D BSP tree primitive comparison */ -#define GL2PS_POINT_COINCIDENT 0 -#define GL2PS_POINT_INFRONT 1 -#define GL2PS_POINT_BACK 2 +#define GL2PS_POINT_COINCIDENT 0 +#define GL2PS_POINT_INFRONT 1 +#define GL2PS_POINT_BACK 2 /* Pass through options */ -#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1 -#define GL2PS_END_POLYGON_OFFSET_FILL 2 -#define GL2PS_BEGIN_POLYGON_BOUNDARY 3 -#define GL2PS_END_POLYGON_BOUNDARY 4 -#define GL2PS_BEGIN_LINE_STIPPLE 5 -#define GL2PS_END_LINE_STIPPLE 6 -#define GL2PS_SET_POINT_SIZE 7 -#define GL2PS_SET_LINE_WIDTH 8 +#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1 +#define GL2PS_END_POLYGON_OFFSET_FILL 2 +#define GL2PS_BEGIN_POLYGON_BOUNDARY 3 +#define GL2PS_END_POLYGON_BOUNDARY 4 +#define GL2PS_BEGIN_LINE_STIPPLE 5 +#define GL2PS_END_LINE_STIPPLE 6 +#define GL2PS_SET_POINT_SIZE 7 +#define GL2PS_SET_LINE_WIDTH 8 typedef GLfloat GL2PSrgba[4]; typedef GLfloat GL2PSxyz[3]; @@ -192,7 +197,7 @@ typedef struct { typedef struct { GLint format, sort, options, colorsize, colormode, buffersize, maxbestroot; const char *title, *producer, *filename; - GLboolean shade, boundary; + GLboolean boundary; GLfloat *feedback, offset[2]; GLint viewport[4]; GL2PSrgba *colormap, lastrgba, threshold;