
public static void frustumM(float[] m, int offset,
float left, float right, float bottom, float top,
float near, float far) {...}
final float ratio = (float) width / height;
final float left = -ratio;
final float right = ratio;
final float bottom = -1.0f;
final float top = 1.0f;
final float near = 1.0f;
final float far = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
计算视椎(视野
),相当于是定义视野范围
可以想象为自己的一只眼睛,以视野中心为坐标中心,能看到得最左边距离为left,最右边为right,最上边为top,最下边为right
能看到的最近的距离为near,最远的距离为far(类似于视力,离眼睛无限近的物体和无限远的物体我们都不能看到)
float[] mProjectMatrix = new float[16];
Matrix.frustumM将计算的结果保存到以上数组中,在绘制的时候进行联合使用