How do I setup openTK so I get a orthographic projection where:
I currenly have this:
_projectionMatrix = Matrix4.CreateOrthographicOffCenter(
ClientRectangle.X, ClientRectangle.Width,
ClientRectangle.Y, ClientRectangle.Height, -1.0f, 1.0f);
I'm not fully able to understand what's happening but is seems the origin is now in the bottom left, also I don't know if the coordinates match with the pixels on screen.
The parameters to Matrix4.CreateOrthographicOffCenter
are the left
, right
, bottom
, top
, near
, and far
of the cuboid view volume.
If the origin of the view (ClientRectangle.Y
) has to be at the top, then you've to swap the top
and bottom
parameter:
_projectionMatrix = Matrix4.CreateOrthographicOffCenter(
ClientRectangle.X,
ClientRectangle.X + ClientRectangle.Width,
ClientRectangle.Y + ClientRectangle.Height,
ClientRectangle.Y,
-1.0f, 1.0f);