+
+ public static Matrix4d glFrustum(double l, double r, double b, double t, double n, double f) {
+ Matrix4d mat = new Matrix4d();
+ mat.m00 = 2.0 * n / (r - l);
+ mat.m11 = 2.0 * n / (t - b);
+ mat.m02 = (r+l) / (r-l);
+ mat.m12 = (t+b) / (t-b);
+ mat.m22 = -(f+n) / (f-n);
+ mat.m23 = -(2.0 *f * n) / (f-n);
+ mat.m32 = -1.0;
+ return mat;
+ }
+
+ public static Matrix4d glOrtho(double l, double r, double b, double t, double n, double f) {
+ Matrix4d mat = new Matrix4d();
+ mat.m00 = 2.0 / (r - l);
+ mat.m11 = 2.0 / (t - b);
+ mat.m22 = -2.0 / (f-n);
+ mat.m33 = 1.0;
+ mat.m03 = -(r+l)/(r-l);
+ mat.m13 = -(t+b)/(t-b);
+ mat.m23 = -(f+n)/(f-n);
+ return mat;
+ }