projection function

List<num> projection(
  1. num width,
  2. num height
)

Creates a 2D projection matrix width width in pixels height height in pixels

Implementation

List<num> projection(num width, num height) {
  // Note: This matrix flips the Y axis so 0 is at the top.
  return [
    2 / width, 0, 0,
    0, -2 / height, 0,
    -1, 1, 1,
  ];
}