With projection matrix:
Latest code:
public void setProjection(int width, int height, double zNear, double zFar){ double right = (width / height); double left = -(width / height); double top = 1.0; double bottom = -1.0; double a_a = (2.0 * zNear) / (right - left); double a_c = -((right + left) / (right - left)); double b_b = (2.0 * zNear) / (top - bottom); double b_c = -((top + bottom) / (top - bottom)); double c_c = zFar / (zFar - zNear); double c_d = -((zNear * zFar) / (zFar - zNear)); double d_c = 1.0; double[][] temp = {{a_a, 0.0, a_c, 0.0}, {0.0, b_b, b_c, 0.0}, {0.0, 0.0, c_c, c_d}, {0.0, 0.0, d_c, 0.0}}; matrix = multiply(matrix, temp); }
I think i need some beer! :P