OpenGL under Python is largely the same as OpenGL under most
other languages, so you can use much of the documentation
you'll find around the Internet, or in your local bookstore. This
page primarily provides links to PyOpenGL-specific documentation.
Users of OpenGLContext should also see the OpenGLContext
These documents tend to focus on the particular APIs and
details of operation for PyOpenGL (or OpenGL in general).
- Installing PyOpenGL and
OpenGLContext -- building and installing the two libraries from
binary or source distributions
- PyOpenGL for OpenGL Programmers
-- quick introduction to various features of PyOpenGL not normally found
in OpenGL programming texts (e.g. strict exception handling, function
aliases, array/pointer methods with Numpy)
- PyOpenGL 3.x Reference
generated versions of the OpenGL programming reference with
Python-specific call-signature annotations for PyOpenGL 3.x series.
These are the OpenGL man-pages with PyOpenGL-specific
annotations. The man pages also contain links to real-world
PyOpenGL source-code which uses the described entry points.
- Contributing -- guide to how to help develop PyOpenGL
OpenGL Platform SDK (including WGL documentation)
- SGI OpenGL Extension
Registry -- where to go to look up an OpenGL extension's semantics
specification collection -- official specifications for OpenGL, GLU
Handbook -- Image handling library for Python
- Numpy Documentation -- documentation for the multi-dimensional array-handling extension
are a large number of very good books on OpenGL available. Many
of these books cover "legacy" OpenGL, rather than the
shader/buffer/texture model of OpenGL 3.0. Still, they provide a
good grounding that allows you to learn the basics of OpenGL.
OpenGL Programming Guide: (The Red Book)
Older versions of the official OpenGL Programming Guide, a.k.a
"The Red Book" are available online in various
places (version 2.0 covers OpenGL 1.1). If you are serious about
learning OpenGL, the newer versions of the Red Book, (v3.0) is likely on
the shelves of your local bookstore, and is quite readable.
You'll find versions of some of the Red Book tutorial code for
Python included in the PyOpenGL-Demo/redbook directory of the PyOpenGL-Demo
distribution. These versions are very close to the original source
code. The OpenGLContext tests directory also has four of the
tutorials converted, "alpha", "alpha3D", "surface" and "trim".
Addison-Wesley Pub Co; ISBN: 0201604582 ; 3rd edition (August
OpenGL Shading Language: (The Orange Book)
book serves as a good introduction to shaders. The shaders
described cover the gamut from the simplest 1-line shaders through code
to emulate legacy operation to non-realistic shading to caustics and
the like. You will generally have to adapt any code you take from
here to work with your real-world scenes, but the book offers a strong
Addison-Wesley Pub Co: ISBN: 978-0-321-33489-3; 2nd edition
book is an all-round introduction, working up from OpenGL 1.0 era
operations all the way to OpenGL 2.x era behaviours. Coverage of
newer features tends to be somewhat sketchy, but coverage of older
features is extensive. It is notable mainly for being somewhat
up-to-date and having exhaustive coverage of what it covers. The
book also makes a great anchor for your average supertanker.
Sams Pub: ISBN 0-672-32601-9; 3rd edition
When people think of an "OpenGL tutorial", many will
immediately think of the NeHe tutorials by Jeff Molofee, available at http://nehe.gamedev.net/
tutorials range from the very simple (create an OpenGL window) through
the advanced (particle systems, loading scenes from various formats,
displaying video textures, text, morphing, multi-texturing). The
older tutorials tend to be legacy-mode operations, so you should keep
in mind that they are describing old ways of working as you learn with
The NeHe tutorials are so popular that there are multiple
Python translations available:
- Included in PyOpenGL-Demo you'll find a
subdirectory NeHe, which includes translations of tutorials 1 through 6,
with a multi-texturing version of tutorial 6 as well. These
translations are very close in their approach to the original tutorial's
approach in terms of their structure and organization. As a
result, they can be somewhat hard to follow as Python code unless you
are following along with the tutorial text and reading the reasoning
behind the C code.
versions by Paul Furber. These are tightly coded direct
translations of the NeHe code, idiomatic (function-oriented) Python.
Tutorials 1 through 10 are available.
- Included with OpenGLContext, in the tests directory, you'll
find a number of files named nehe*.py, these are, as you might expect,
translations of the corresponding tutorials. These translations
are results-focused, they do not follow the tutorial's structure,
instead they use best (object-oriented) practices in Python programming,
and particularly OpenGLContext programming without completely violating
the idea of the tutorials (they try to keep the executed code in a
single file, with minimal external dependencies). Tutorials 1 through 8
are translated, with the glprint.py test being a loose translation of
tutorial 13 (bitmapped text). The OpenGLContext documentation
collection includes the source online, with brief discussions of the
differences from the tutorial code.
- The NeHe tutorials themselves link to (very old)
translations which very closely followed the original tutorial
structure. These tutorials served as the base for the versions in
the PyOpenGL distribution. I would not recommend using them for
If you have a PyOpenGL-specific tutorial you'd like added to this area, please post to the PyOpenGL-user's mailing list.
- OpenGLContext Tutorials are a series of "annotated code" walk-throughs including some more advanced topics, such as shadow-casting, VBOs and GLSL shaders
- Developing emol (ShowMeDo video tutorials) by Erik Thompson -- develops a molecular viewer using wxPython, PyOpenGL and bzr
Resources and Links
Here are some starting points for further
- OpenGL.org -- The
official home of OpenGL on the World Wide Web, includes extensive links
to documentation, specifications, and companies involved with OpenGL.
-- introductory, slowly-building tutorials, similar to the NeHe tutorials
Tutorials -- intermediate tutorials on various OpenGL-related
- Gamasutra --
professional-level tutorials, often on "cutting edge" subjects,
generally well-written and easily followed code, note that a free
registration is required for much of the content, also see their
publisher's site, Gamedev.net,
which has a decent resources section