Skip to content

@blooper.gg/toodle


@blooper.gg/toodle / math/matrix / createProjectionMatrix

Function: createProjectionMatrix()

createProjectionMatrix(resolution, dst?): Float32Array

Defined in: math/matrix.ts:21

Creates a projection matrix for the given resolution. The matrix is a 3x3 matrix that converts screen coordinates centered at the origin ranging from:

(-resolution.width / 2, resolution.height / 2) = top left corner to (resolution.width / 2, -resolution.height / 2) = bottom right corner

into clip space centered at the originranging from:

(-1, 1) = top left corner to (1, -1) = bottom right corner

Parameters

resolution

Resolution

The resolution of the screen in logical pixels.

dst?

Float32Array

The destination matrix.

Returns

Float32Array

The projection matrix.