Preparing an orthographic projection matrix
Orthographic projection is another type of operation that transforms vertices from their local coordinate system to a clip space. But opposed to a perspective projection, it doesn't take a perspective division into account (doesn't simulate the way we perceive our surroundings). But similarly to a perspective projection, it is also represented by a 4x4 matrix, which we need to create in order to use this type of projection.
How to do it...
- Create two variables of type
float
namedleft_plane
andright_plane
, and initialize them with the positions (on thex
axis) of left and right clipping planes, respectively. - Prepare two variables of type
float
namedbottom_plane
andtop_plane
. Initialize them with positions of (on they
axis) of the bottom and top clipping planes, respectively. - Create two variables of type
float
namednear_plane
andfar_plane
. Use them to hold distances from the camera to the near and far clipping planes, respectively. - Create a variable...