Directx 11 2D ortho

时间:2017-06-15 23:24:28

标签: c++ directx-11

我使用Directx 11,我在设置相机时遇到了一些问题。 我想将原点设置在sceen的左上角,目前它位于bot左侧,这就是我设置它的方式:

D3DXMatrixIdentity(&mProjection);
D3DXMatrixIdentity(&mView);

mPosition = D3DXVECTOR3{ 0.0f, 0.0f, -0.5f };
mTarget = D3DXVECTOR3{ 0.0f, 0.0f, 0.0f };
mUp = D3DXVECTOR3{ 0.0f, 0.0f, 0.0f };

D3DXMatrixOrthoOffCenterLH(&mProjection,
    0.0f, static_cast<Float32>(WindowWidth),
    0.0f, static_cast<Float32>(WindowHeight), 0.0f, 1.0f);

这就是我想要的方式enter image description here

这是我的coord系统:enter image description here

1 个答案:

答案 0 :(得分:0)

交换y参数以构建矩阵:

D3DXMatrixOrthoOffCenterLH(&mProjection,
0.0f, static_cast<Float32>(WindowWidth),
static_cast<Float32>(WindowHeight), 0.0f, 0.0f, 1.0f);
相关问题