g-truc / glm

OpenGL Mathematics (GLM)
https://glm.g-truc.net
Other
9.2k stars 2.12k forks source link

Update Question (0.9.8.0 -> 0.9.9.1) #823

Closed bjadamson closed 5 years ago

bjadamson commented 6 years ago

Hi, I'm in the process of upgrading the version of GLM I use in my project. I am upgrading

from: official release version 0.9.8.5 to: 0.9.9.0 (I went straight to 0.9.9.1 and had the same issues, so I thought a progress route was the best course of action).

What I'm running into is that multiplying a vec3 * quat used to work in the 0.9.8.5 version, however in 0.9.9.0 it no longer works. I've tried changing my code a little:

~~ie change: previous: vec3 quat; to this: glm::vec4{vec3, 0.0f} glm::toMat4(quat);~~

However my scene I'm rendering using OpenGL looks wrong now. I'm guessing this change I've made above is nonsensical mathematically. (See edit at end)

What's the path for upgrade in this scenario? Can anyone explain to me why support for mutliplying a vec3 * quat was removed?

I should point out, that quat * vec3 still works, but I believe it has different semantics that because my scene doesn't render if I swap the order. I could be easily be wrong about this, I'm still learning a lot here.

Thanks!

edit: I went back and tried changing my

from: vec3 quat to: vec4 glm::toMat4(quat)

using the 0.9.8.5 version of glm and my scene renders correctly. This leads me to believe something else changed from 0.9.8.5 -> 0.9.9.0 transition causing my scene to no longer render).

Groovounet commented 5 years ago

Hi, Did you try to use GLM_FORCE_CTOR_INIT to ensure that types are initialized?

bjadamson commented 5 years ago

Yep! I went through the defines, tried to find all I could that were (seemingly) relevant and tried defining them. No luck

In the end I didn't end up needing to upgrade to 0.9.9.0, so for now I'm just sitting at 0.9.8.5. I plan to upgrade to the latest version someday, so I'll have to come back to this.

bjadamson commented 5 years ago

Ok, I leaned in a little bit more and found where my issue is coming from. The problem (for me) is that this inverse function was removed in the transition from 0.9.9.0 -> 0.9.9.1

The commit (it took a couple secs to load on my PC, I guess the commit was huge) https://github.com/g-truc/glm/commit/8c9d16d868045ad9c59ff954eeceb1f61454289a#diff-5536287c4a03d932ed1c4272916450a6L222

I'm sure there's a reason (hopefully?) this was removed. Hopefully I can inquire from the commit's author @Groovounet (:

edit: Updated the commit url.

bjadamson commented 5 years ago

Ok I solved the issue.

The problem was (for release <glm/ext.hpp>) I was including <glm/ext.hpp> before I was including <glm/ext/quaternion_extensions.hpp>.

The solution was to include <glm/ext/quaternion_extensions.hpp> before <glm/ext.hpp>