OpenGL matrix math utilities for Python?

You can use numpy to generate data that is compatible with OpenGL. Many of the PyOpenGL calls can take numpy data structures directly (assuming it's the correct type). Additionally, numpy arrays are typically well arranged in memory, and so you can do what you want with the data (and it's easy to check how they are arranged).


I created the library Pyrr to provide all the maths features you need for Core OpenGL. It features matrices, vectors and quaternions and basic support for other primitives (rectangles, rays, lines, etc).

It has both a procedural API and, more recently, an Object Oriented API which is very powerful.

It's available on PyPi pip install pyrr and from the github link above.

Feedback, issues and new features are welcome!