public static void orthoM ( float [ ] m , int mOffset , float left , float right , float bottom , float top , float near , float far ) { if ( left == right ) { throw new IllegalArgumentException ( "left == right" ) ; } if ( bottom == top ) { throw new IllegalArgumentException ( "bottom == top" ) ; } if ( near == far ) { throw new IllegalArgumentException ( "near == far" ) ; } final float r_width = 1.0f / ( right - left ) ; final float r_height = 1.0f / ( top - bottom ) ; final float r_depth = 1.0f / ( far - near ) ; final float x = 2.0f * ( r_width ) ; final float y = 2.0f * ( r_height ) ; final float z = - 2.0f * ( r_depth ) ; final float tx = - ( right + left ) * r_width ; final float ty = - ( top + bottom ) * r_height ; final float tz = - ( far + near ) * r_depth ; m [ mOffset + 0 ] = x ; m [ mOffset + 5 ] = y ; m [ mOffset + 10 ] = z ; m [ mOffset + 12 ] = tx ; m [ mOffset + 13 ] = ty ; m [ mOffset + 14 ] = tz ; m [ mOffset + 15 ] = 1.0f ; m [ mOffset + 1 ] = 0.0f ; m [ mOffset + 2 ] = 0.0f ; m [ mOffset + 3 ] = 0.0f ; m [ mOffset + 4 ] = 0.0f ; m [ mOffset + 6 ] = 0.0f ; m [ mOffset + 7 ] = 0.0f ; m [ mOffset + 8 ] = 0.0f ; m [ mOffset + 9 ] = 0.0f ; m [ mOffset + 11 ] = 0.0f ; }
Computes an orthographic projection matrix .