An OpenGL® to Postscript®
Class Library
GLP is a C++ class library that uses the feedback mechanism in OpenGL library to generate Adobe Postscript output suitable for printout or inclusion in a document. Use of GLP is governed by the GNU Library General Public License.
Source code for GLP version 0.1 is freely available:
GLP 0.1 Source Code for UNIX machines (libGLP-0.1.tar.gz)
GLP 0.1 Source Code for Windows 95/NT machines (libglp01.zip)
GLP is currently under development and version 0.1 can be considered (at best) a "beta" release. GLP only supports vector drawing primitives (points, lines, triangles, quads, polygons) due to limitations in the OpenGL feedback mechanism. The OpenGL Stream extension (GLS) proposed by Silicon Graphics® may remove this limitation. Feedback is used to reduce memory requirements and improve output quality. It also works around one particularly nasty problem with the current OpenGL implementation under X - you can't share display lists between direct and indirect contexts (like you'd use for an off-screen Pixmap).
Version 0.1 implements the following functionality:
All vector drawing primitives
Index and RGBA color modes
Basic "painter's" algorithm depth sort
Flat and smooth shading
Greyscale and color PostScript output
Background/clear color
Inversion of black/greyscale colors
Automatic scaling and rotation to fit the current page
Missing from 0.1 is:
Texture images
Advanced B-Tree depth sort with excess primitive removal
Blending/transparency
Windows GDI class
Documentation :)
Implementation Details
GLP is implemented as a C++ class library. The GLPcontext class provides all the basic feedback and primitive insertion functions as well as a standard framework for different types of output. This is flexible enough that you can write subclasses that output PostScript, or HPGL, or use the Windows GDI interface without having to duplicate a lot of code and effort.
GLP's design is a drastic departure from the old PSGL library which intercepted IRIS GL calls. GLP can catch the output from libraries and functions you call but didn't write. It also implements a much more intelligent depth sorting algorithm that handles transparency and automatically removes/clips primitives that are fully obscured. The result is a reasonably well optimized output stream that produces a (relatively) small file that yields higher quality output than a straight render-to-bitmap approach does.
参考资料:http://www.easysw.com/~mike/opengl/