I have been been working on refactoring a project from 0.8.5 to 0.9. Everything works except the matrix multiplication seems to differ from the old one.
My question is therefore, when you refactor this:
mShapeToView.setToIdentity(); mShapeToView.translate(Vec3f(0.5 * mViewSize)); mShapeToView.scale(Vec3f(mViewScale, mViewScale, 1.0f)); mShapeToView.translate(Vec3f(-mShapeOffset)); mViewToShape = mShapeToView.affineInverted();
to this 0.9, shouldn’t it look like this?
mShapeToView = mat4(1); //Identity matrix mShapeToView *= glm::translate(vec3(0.5f * mViewSize,0.0f)); mShapeToView *= glm::scale(vec3(mViewScale, mViewScale, 0.0f)); mShapeToView *= glm::translate(vec3(-mShapeOffset,0.0f)); mViewToShape = glm::affineInverse(mShapeToView);
That and and in my draw()
before it was:
After having looked through the code so many times that I’ve lost track of the total number of times, I’m thinking the problem must lie somewhere in my matrix transformation, I’m just not sure where.
I do know that glm uses column major instead of row major but I believe that, that shouldn’t be part of the problem here.
You can find the project here:
if you want to look at the code, the matrix transformation happens in
TransformUI.cpp line 34:
and my push/pop from line 203 to 225.