I find matrixCompMult but it only support 2 matrix input. So how can I multiply a matrix with a vector ? Thanks!

You could try and construct another matrix out of your vector then use that in the matrixCompMult?

edit: note that the openGL equivalent is also matrix only: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/matrixCompMult.xhtml

and as per: https://learnwebgl.brown37.net/12_shader_language/glsl_mathematical_operations.html

GLSL only supports square matrices, so the size of two matrices must be equal to multiply them together. A vector is treated as either a row or column vector whenever it is multiplied by a matrix, whichever makes the operation correct. You do not have to transpose a vector as you would in normal matrix algebra.

What exactly are you trying to compute? You can definitely multiply vectors by matrices, that is how you compute vertex positions and many things in shaders. Or is there something special you are trying to do, I don't quite understand the question.

mat4 myMatrix;
vec4 myVector;
// fill myMatrix and myVector somehow
vec4 transformedVector = myMatrix * myVector;

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

2 years later