Closed srikrishna0130 closed 5 years ago
Great question! I dusted off my rusty matrix mathematics and decided to take a stab at answering it.
Let's start off by making sure that we are on the same page here. A 4x4 transformation matrix looks like this:
And, the order of operations in a single matrix is the following in gl-matrix:
In other words, if you translate a matrix by a vector, gl-matrix first scales and rotates the vector.
And this is exactly what is happening here
I hope that I explained it in an understandable manner. If you have any further questions, feel free to ask.
Issue closed because gl-matrix is doing the "right" thing, at least according to the usual WebGL/OpenGL conventions.
I think the mat4.translate function dosen't work as intended. I performed the following operations :
mat4.translate(modelviewmatrix,modelviewmatrix,translate);
and,mat4.scale(modelviewmatrix,modelviewmatrix,scale); mat4.translate(modelviewmatrix,modelviewmatrix,translate);
To achieve the translation observed in code 1 i needed to translate the second one by scale*translate in the code 2.
I then had a look at the source code ` if (a === out) {
} `
To make the code work as intended i think this part needs a change to , ` if (a === out) {
}`
Sorry for any error i made...