void matrixPerspective(float* matrix, float fieldOfView, float aspectRatio, float zNear, float zFar) { float ymax, xmax; ymax = zNear * tanf(fieldOfView * M_PI / 360.0); xmax = ymax * aspectRatio; matrixFrustum(matrix, -xmax, xmax, -ymax, ymax, zNear, zFar); }
// Projection matrix handling - see http://www.opengl.org/wiki/GluPerspective_code void matrixPerspective(float result[16], float fovy_degrees, float aspect_ratio, float znear, float zfar) { float ymax, xmax; ymax = znear * tanf(fovy_degrees * PI_FLOAT / 360.0f); xmax = ymax * aspect_ratio; matrixFrustum(result, -xmax, xmax, -ymax, ymax, znear, zfar); }