Hello
I’m trying to understand some GLES2 basic examples. In particular, I’m following this example here:
https://github.com/robclark/kmscube/blob/master/kmscube.c
The problem is it seems to be using some twisted matrix maths.
If we take a look at this call:
esMatrixMultiply(&modelviewprojection, &modelview, &projection);
we can see it’s composing the modelviewprojection matrix like this: 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?
" gl_Position = modelviewprojectionMatrix * in_position;
"
This makes no sense at all: if we have a column-major modelviewprojection matrix, we should use it like this:
" gl_Position = in_position * modelviewprojectionMatrix;
"
where in_position is a row-vector instead of the usual column vector.
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?
thanks