For example, a raster image of size 1200 by 1200 pixels would more than
fill the typical 20-inch CRT but only result in a printed image of only 4
by 4 inches if printed at 300 dpi.
To print an 10 by 8-inch image at 300 dpi would require a raster image of
3000 by 2400 pixels.
This is a situation in which off-screen, tiled rendering is useful.
For more information see
OpenGL/Mesa Offscreen Rendering
and TR, a tile rendering utility library for OpenGL.
Once you have a raster image in memory it needs to be written to a file.
If printing is the only intended purpose for the image than directly
writing an Encapsulated Postscript file is best.
Mark Kilgard's book Programming OpenGL for the X Window System
contains code for generating Encapsulated Postscript files.
The source code may be downloaded from
ftp://ftp.sgi.com/pub/opengl/opengl_for_x/xlib.tar.Z.
Getting the highest quality vector output is application dependant.
That is, the application should probably generate vector output by
examining its scene data structures.
If a more general solution is desired there are at least two utilities
which may help:
GLP
(http://dns.easysw.com/~mike/glp/) is a C++ class library which uses
OpenGL's feedback mechanism to generate Postscript output.
GLP is distributed with a GNU copyright.
GLpr
(http://www.ceintl.com/products/GLpr/) from Computational Engineering
International, Inc. is a utility library OpenGL printing.
The product is currently in beta release.
2. Bitmap-based Output
A simple solution to OpenGL hardcopy is to simply save the window image
to an image file, convert the file to Postscript, and print it.
Unfortunately, this usually gives poor results.
The problem is that a typical printer has much higher resolution than a CRT
and therefore needs higher resolution input to produce an image of reasonable
size and fidelity.
3. Vector-based Output
In general, high quality vector-style hardcopy is difficult to produce
for arbitrary OpenGL renderings.
The problem is OpenGL may generate arbitrarily complex raster images
which have no equivalent vector representation.
For example, how are smooth shading and texture mapping to be converted
to vector form?