CPSC 426 Resources

Python

In the assignments we will primarily use Python for programming. While C++ is more traditional, and virtually unavoidable for many performance-critical tasks in graphics, a higher level language like Python provides significant advantages in creating complex user applications quickly. Python has also rapidly become the standard scripting language in the film industry, and is popular in many other contexts, so is well worth learning in any case.

Python has a well-supported legacy branch, version 2.7, which we will use. There is also a more forward-looking branch, version 3.x, which unfortunately is not as well supported by libraries yet---when looking for resources on learning Python, make sure you stick with Python 2.x as the two variants of the language aren't entirely compatible.

The official documentation for Python 2.7 is here: docs.python.org. The Tutorial and the Library Reference are probably the highest priority things to look at. There are also a variety of books and other online tutorials which you may like: dig around on the main Python website to get started.

Qt

Qt is probably the premier cross-platform application/GUI library, though several viable alternatives exist.

While Qt is natively a C++ project, it has excellent bindings to other languages including Python. In fact, there is a choice of two for Python now: PyQt and PySide. They are essentially compatible, with licensing being the chief difference between them right now. PyQt is installed on the department Linux machines.

OpenGL

You should be very familiar with OpenGL from CPSC 314. We'll be using it again in 426, both for simple real-time rendering and for slower high quality rendering. However, we won't be using (much of) the deprecated parts of OpenGL from the pre-2.0 past, but rather taking a more modern approach with arrays, buffers, and shaders.

There is a convenient set of OpenGL bindings for Python, PyOpenGL. We will use this in conjunction with the QGLWidget class from PyQt4 / PySide.

Numpy

Numpy is the standard numerical array package for Python: it provides efficient multidimensional arrays and associated operations, including basic linear algebra support. This will be useful in this course both for image processing and optimization algorithms, for example.

ImagePlay

Here is Python source code for a simple image sequence player (with frame control, frame rate control) which may also be useful as an example to base other Python programs on:

Python OpenGL Examples

Here is Python source code demonstrating an extremely simple program that uses OpenGL 2.0 in a modern-ish way: vertex buffer objects (VBOs) and shaders, instead of the bad old glBegin/glEnd and fixed function shading pipeline:

I've modified this also to make it easier to start experimenting with GLSL shading, on a larger mesh, as shown in class:

Here's the basis of a usable 3d view with interactive camera, axes and wireframe box rendering. It includes examples of setting up transformation matrices in Python, and passing them to OpenGL shaders as needed.