moderngl / moderngl-window

A cross platform utility library for ModernGL making window creation and resource loading simple
MIT License
245 stars 60 forks source link

Deprecate Pyrr in favour of PyGLM #176

Open klattimer opened 1 year ago

klattimer commented 1 year ago

Pyrr is slow, incomplete and has some bugs. Numpy code in there isn't accelerated by hardware at all, whereas GLM tends to use the fastest method for the CPU you're on (Neon/VFP etc...). The transition isn't difficult - largely changing Vector3 to glm.vec3. I may provide a PR if that would be of interest.

https://pypi.org/project/PyGLM/ https://github.com/Zuzu-Typ/PyGLM/tree/master/wiki/function-reference < easiest documentation access https://glm.g-truc.net/0.9.0/api/index.html https://github.com/Zuzu-Typ/PyGLM/

I switched my app code to pyglm because pyrr dropped my frame rates with every new calculation added, it hit 27fps before I switched, with glm I'm getting 60fps again.

szabolcsdombi commented 1 year ago

Back when we added the examples using Pyrr PyGLM did not exist. For my newer projects I also use PyGLM, or glm directly from C++. If you or anyone can find the time to upgrade some/all of the examples. I would be really glad to merge it.

The only thing I don't like about PyGLM or glm is the mismatched order of the quaternion members. While math may allow for any representation order such as x, y, z, w, OpenGL and GLSL specifically rely on this order. Unfortunately, glm uses the w, x, y, z order for both memory and constructor layout.

Putting that aside, I think PyGLM is one of the best choises out there.

klattimer commented 1 year ago

It's not just the examples, but the scene loader too, I think I might be able to do a dirty replace on it if I get time this weekend. Dropping a bad old dependency is always good.