2017-06-15 74 views
0

我開始使用Directx 11,並且在設置相機時遇到了一些問題。 我想設置原點到sceen的左上角,它是目前在機器人左,這是我應該如何進行設置:Directx 11 2D ortho

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

這是目前我的座標系統:enter image description here

+0

您應該避免使用傳統D3DXMath庫。它僅在已棄用的''D3DX11''幫助程序庫中受支持。見[沒有D3DX的生活](https://blogs.msdn.microsoft.com/chuckw/2013/08/20/living-without-d3dx/) –

回答

0

交換y參數構建矩陣:

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

sry它沒有工作,如果我這樣做,我沒有看到紋理 –

+0

可以給我頂點嗎?另外,檢查你的三角形是不是現在被剔除 –

+0

OMG I忘記改變它的性能omg非常感謝你,你是最好的 –