Skip to main content

perspective

Function perspective 

Source
pub fn perspective(
    vertical_fov: f64,
    aspect_ratio: f64,
    near: f64,
    far: f64,
) -> DMat4
Expand description

Creates a perspective projection matrix for use with OpenGL.

Expects a left-handed Y-up view space input. Outputs NDC with Z in [-1, 1] and Y-up.

§Panics

Will panic if vertical_fov is not in the range (0, π), if aspect_ratio is zero, or if near or far are less than or equal to zero, or if near is equal to far, when glam_assert is enabled.