I am developing the OpenGLES 2.0 application for raspberry pi 3. I am new to both OpenGL and OpenGL ES. I am currently learning OpenGLES from the book called Raspberry Pi GPU Audio Video Programming by Newmarch, Jan.

The authors Newmarch, Jan use the implementation of the ES Framework API of the Apress OpenGLES 2.0 Programming Guide Aaftab Munshi et al. from here, the files in **Common** The directory contains the source files of the API structure.

Now my problem is, the API for the translation matrix is implemented in the file **Common / esTransform.c** in the following way.

The API takes the 4×4 identity matrix and stores the newly calculated values back into the same array pointer variable.

```
null ESUTIL_API
esTranslate (result of ESMatrix *, GLfloat tx, GLfloat ty, GLfloat tz)
{
result-> m[3][0] + = (result-> m[0][0] * tx + result-> m[1][0] * ty + result-> m[2][0] * tz);
result-> m[3][1] + = (result-> m[0][1] * tx + result-> m[1][1] * ty + result-> m[2][1] * tz);
result-> m[3][2] + = (result-> m[0][2] * tx + result-> m[1][2] * ty + result-> m[2][2] * tz);
result-> m[3][3] + = (result-> m[0][3] * tx + result-> m[1][3] * ty + result-> m[2][3] * tz);
}
```

If you verify the previous code, the matrix indices are exchanged by LHS of the equation. The translation matrix will look like this if we enter the 4×4 identity matrix into the API:

$$

begin {bmatrix}

1 & 0 & 0 & 0 \

0 & 1 & 0 & 0 \

0 & 0 & 1 & 0 \

tx & ty & tz & 1 \

end {bmatrix}

$$

When looking at the matrix it looks good, I just have to transpose before multiplying. Where as another implementation as **isRotate**, **esScale** it does not output the transposed matrix. But it is this minor problem that can be corrected.

These are my questions:

- Why do the first three elements have a great equation?

They should be:

`result-> m[3][0] + = tx;`

`result-> m[3][1] + = ty;`

`result-> m[3][2] + = tz;`

`result-> m[3][3] = 1;`

- Why the last element?
*result-> m[3][3]*Is he having an equation? It is a homogeneous coordinate that must always be 1. - If the API is correct, in what scenarios are these equations used?

Is my understanding of the translation wrong? If the API is worn out, then these API implementations are in GITHUB for the past 7 years and, strangely enough, did anyone notice the error?