Something funny about how Android FrustumM works. If I check the OpenGL red book, the generated matrix will look like this:

(source: glprogramming.com )
Songho.ca seems to agree with this:

(source: songho.ca )
However, one component is multiplied by 2 with Android FrustumM, and not in other matrix examples. Here is what he does:

Everything seems to coincide functionally, with the exception of the first row, third column. Why is this multiplied by two? Here are the lines of code from the android.opengl.Matrix frustumM method that generate the first three elements of the third column:
final float A = 2.0f * ((right + left) * r_width); final float B = (top + bottom) * r_height; final float C = (far + near) * r_depth;
With r_width, r_height, r_depth defined as:
final float r_width = 1.0f / (right - left); final float r_height = 1.0f / (top - bottom); final float r_depth = 1.0f / (near - far);
A line starting with "final float A" is mistakenly multiplied by 2.
Is this an error in the Android code, or am I missing something? I know that the term is canceled if truncated symmetrically. When executing code with asymmetric truncation, the generated matrices are actually different, as are the resulting vectors, when the same vector is multiplied by these different matrices.
source share