具有左上原点的 OpenTK 正交投影

OpenTK orthographic projection with left top origin

如何设置 openTK 以便获得正交投影,其中:

我目前有这个:

_projectionMatrix = Matrix4.CreateOrthographicOffCenter(
    ClientRectangle.X, ClientRectangle.Width,
    ClientRectangle.Y, ClientRectangle.Height, -1.0f, 1.0f);

我不能完全理解发生了什么,但似乎原点现在在左下角,我也不知道坐标是否与屏幕上的像素匹配。

Matrix4.CreateOrthographicOffCenter 的参数是 leftrightbottomtopnearfar 的长方体视图体积。

如果视图原点 (ClientRectangle.Y) 必须位于顶部,则必须交换 topbottom 参数:

_projectionMatrix = Matrix4.CreateOrthographicOffCenter(
    ClientRectangle.X, 
    ClientRectangle.X + ClientRectangle.Width,
    ClientRectangle.Y + ClientRectangle.Height, 
    ClientRectangle.Y,
    -1.0f, 1.0f);