title: Why does the matrix generated by Android's frustumM differ from the Redbook's?
body: <p>Something seems funny about the way that Android's frustumM works. If I check the OpenGL red book, the matrix generated looks like this:<br/>
  <a href="https://i.stack.imgur.com/AJvpX.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AJvpX.gif" alt="" /></a><br />
  <sub>(source: <a href="http://www.glprogramming.com/red/images/Image23.gif" rel="nofollow noreferrer">glprogramming.com</a>)</sub><br />
  <br/>
  Songho.ca seems to agree with this:<br/>
  <a href="https://i.stack.imgur.com/WFNOi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WFNOi.png" alt="" /></a><br />
  <sub>(source: <a href="http://www.songho.ca/opengl/files/gl_projectionmatrix_eq16.png" rel="nofollow noreferrer">songho.ca</a>)</sub><br />
  <br/></p>
  <p>However, one component is multiplied by 2 with Android's frustumM, and not in the other example matrices. Here's what it seems to be doing:<br/>
  <img src="https://i.imgur.com/vhtcg.png"><br/></p>
  <p>Everything seems to functionally match up, <em>except</em> the first row, third column. Why is that being multiplied by two? Here's the lines of code from android.opengl.Matrix's frustumM method that generate the first three elements of the third column:</p>
  <pre><code>final float A = 2.0f * ((right + left) * r_width);
  final float B = (top + bottom) * r_height;
  final float C = (far + near) * r_depth;
  </code></pre>
  <p>With r_width, r_height, r_depth defined as:</p>
  <pre><code>final float r_width  = 1.0f / (right - left);
  final float r_height = 1.0f / (top - bottom);
  final float r_depth  = 1.0f / (near - far);
  </code></pre>
  <p>The line starting with &quot;final float A&quot; appears to be mistakenly multiplying by 2.</p>
  <p>Is this a mistake in Android's code, or am I just missing something? I know that the term cancels out if the frustum is symmetrical. When running the code with an asymmetrical frustum, the generated matrices actually are different and so are the resulting vectors when the same vector is multiplied with those differing matrices.</p>