Reputation: 55
thanks to list for WebGL vec4()
help! It was fast; don't know if a Google search (Swizzling) would have worked, but maybe?
Another WebGL question; then I should have resources from list to help me in future WebGL q's. I guess a good WebGL book would have answered this; although I am reading WebGL Programming Guide by Matsuda and Lea. I am 61 years old and books are how I learned in the past but guess that online is the way now.
I don't know what m3 is in the following WebGL statement:
matrix = m3.translate(matrix,translation[0],translation[1]);
I know there are Matrix definitions and Matrix4
objects but no help here.
Again, thank you.
Upvotes: 2
Views: 355
Reputation: 464
This book you quote is gold to learn WebGL in the right way! Glad we can help here too (By the way, please remember to accept the best answer here )
m3 is an instance of Matrix4 type you can find in cuon-matrix.js. Every example in the book uses this file for the maths part.
matrix = m3.translate(matrix,translation[0],translation[1]);
The translate function actually applies a translation on 3 axis to the matrix instance (m3 in your case)
Matrix4.prototype.translate = function(x, y, z)
Thus the line of code you ask for is wrong. You should not pass matrix as first parameter. There are only 3 params: the translation amount on x, y and z axis.
Upvotes: 1