[quote name='rubenhak' timestamp='1315637398' post='4859902']This looks very weird, as matrix multiplication operation is associative (A * B) * C = A * (B * C).
Except that they are talking about matrix multiplcation. That is, C is not a vector when they write that.
The meaning is that (A * B) * C will create the same
matrix as A * (B * C).
Using (
gl_ModelViewProjectionMatrix * gl_Vertex) is the same as using (
gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex) because the result of (
gl_ProjectionMatrix * gl_ModelViewMatrix) is a matrix equal to
gl_ModelViewProjectionMatrix.
L. Spiro
[/quote]
Vector is a custom case of a m-by-n matrix where m (or n) is equal to 1.
I need to calculate value of
pos:
pos = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
I just want to do it differently:
p1 = gl_ModelViewMatrix * gl_Vertex;
p2 = gl_ProjectionMatrix * p1;
resulting
p2 is not equal to
pos. Could you explain me why? Manually I substitute any random values into gl_ProjectionMatrix, gl_ModelViewMatrix and gl_Vertex values and calculate pos and p2 manually and get equal results. However, in GLSL getting different values. Any ideas why?