Skip to content

ch3 how the orthographic projection matrix computed? #91

@changkaizhao

Description

@changkaizhao

when drawing background texture, how does its orthographic projection matrix computed?
it gave as below

static const GLfloat proj[] =
{
  0,        -2.f/w,     0,      0,
  -2.f/h,      0,       0,       0,
  0,              0,       1,       0,
  1,               1,        0,       1
};

but I found the orthographic projection matrix has the structure like this: https://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/orthographic-projection-matrix

[
 2/(r-l)     0         0           -(r+l)/(r-l)
 0          2/(t-b)   0         -(t+b)/(t-b)
0             0         -2/(f-n)     -(f+n)/(f-n)
0            0           0                   1
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions