I'm trying to understand some GLES2 basic examples. In particular, I'm following this example here:
The problem is it seems to be using some twisted matrix maths.
If we take a look at this call:
we can see it's composing the modelviewprojection matrix like this: modelview . projectionCode :esMatrixMultiply(&modelviewprojection, &modelview, &projection);
It's ok, let's suppose it's because modelview and projection are column-major matrices, so we are obtainig the correct matrix but in column-major format. But then, why do we see this on the GLSL vertex shader?
This makes no sense at all: if we have a column-major modelviewprojection matrix, we should use it like this:Code :" gl_Position = modelviewprojectionMatrix * in_position;\n"
where in_position is a row-vector instead of the usual column vector.Code :" gl_Position = in_position * modelviewprojectionMatrix;\n"
My other question is: why does esRotate() produce row-major matrices while esFrustrum() produces column-major matrices? Makes no sense. One or the other, but why is it different in each one?