Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL matrix math utilities for Python?

Before I do it myself, are there any Python libraries available for OpenGL-specific/compatible matrix math on 4x4 matrices? Basically, I need about the feature set offered by Android's android.opengl.Matrix class.

like image 877
dietr Avatar asked Apr 15 '12 13:04

dietr


2 Answers

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!

like image 159
Rebs Avatar answered Oct 27 '22 23:10

Rebs


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).

like image 39
Henry Gomersall Avatar answered Oct 28 '22 01:10

Henry Gomersall