Announcement: The easy to remember URL for this site is http://www.graphicsgems.org/.
This is the official on-line repository for the code from the Graphics Gems series of books (from Academic Press). This series focusses on short to medium length pieces of code which perform a wide variety of computer graphics related tasks. All code here can be used without restrictions. The code distributions here contain all known bug fixes and enhancements. We also provide errata listings for the text of each book. Please report any new errata or bugs to Eric Haines. Better yet, submit a pull request to the Github repository.
The gems can be viewed by category, by book, or by author. Gems code can be accessed in a variety of ways: by viewing the code directly from these pages or by downloading the whole website or a book's entire code base. Best is probably downloading the code from Github.
New: you can search inside all the books on Amazon (though content is limited), and excerpts of many articles are available on Google Books. Links below.
|Table of Contents: by book, by category, by author, text file|
|Entire Gems Website||Download zip from Github repository|
|Graphics Gems||Errata listing||Look Inside||Excerpts||Purchase Book|
|Graphics Gems II||Errata listing||Look Inside||Excerpts||Purchase Book|
|Graphics Gems III||Errata listing||Look Inside||Excerpts||Purchase Book|
|Graphics Gems IV||Errata listing||Look Inside||Excerpts||Purchase Book|
|Graphics Gems V||Errata listing||Look Inside||Excerpts||Purchase Book|
|Graphics Gems V: sampling patterns|
There is also a bookmarked PDF version of all the gems, created by Guillermo Gallo. It is somewhat out of date (March 2001), but handy for viewing and searching the entire code distribution.
The "sampling patterns" are data files related to Robert Cross' Gem, Sampling Patterns Optimized for Uniform Distribution of Edges.
Here is publication information and Amazon links for the books themselves:
The ISBN numbers listed are for the books with IBM PC disks included, with Mac versions in parentheses. The archives at this site are newer than those in the books, as the include the most up-to-date code with all known bug fixes.
Thanks to everyone who has provided corrections to this code repository over the years. I would especially like to thank Ben Dawson, who found a large number of problems that had been lurking in the code base for years.
Common code files: the original GraphicsGems.h, GGVecLib.c, and GraphicsGems.c (which replaces GGVecLib.c) files are found in their book's related directories, as these vary from volume to volume. The common, maintained versions for all of these are found at the root GraphicsGems.h and GraphicsGems.c files.
EULA: The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes with no guarantee.
Related Resources: The Graphics Gems series has been ended by the founding editor, Andrew Glassner. To allow continued presentation of new results, he started the journal of graphics tools, a quarterly which includes Gems-like material and which has a free code repository. This was then succeeded by the Journal of Computer Graphics Techniques, an open-source journal in which many of the articles include code.
An excellent place for solid code for all sorts of basic graphics algorithms is Dave Eberly's Geometric Tools site.
Another useful site is the 3D Object Intersection page. Gems and other articles about various intersection algorithms are shown here.
The archive at Geometry Algorithms has a number of good articles on common geometric operations relevant to graphics.