Decompose projection matrix44 to left, right, bottom, top, near and far boundary values

android, opengl-es, qcar-sdk

Solution

Here are the resolutions of the equation systems Christian Rau referred to :

For an orthographic matrix :

near   =  (1+m34)/m33;
far    = -(1-m34)/m33;
bottom =  (1-m24)/m22;
top    = -(1+m24)/m22;
left   = -(1+m14)/m11;
right  =  (1-m14)/m11;

For a perspective matrix :

near   = m34/(m33-1);
far    = m34/(m33+1);
bottom = near * (m23-1)/m22;
top    = near * (m23+1)/m22;
left   = near * (m13-1)/m11;
right  = near * (m13+1)/m11;

You can replace the values m11, m12, etc., by the formulas defined in the documentation for glOrtho and glFrustum to check it's correct.

Problem

Can any one help me to get left, right, bottom, top, near and far boundary values from projection matrix44?

Original source