How to use D3DXLine
It doesn't work.
The code:
D3DXMATRIX matWorld;
D3DXMatrixIdentity(&matWorld);
D3DXVECTOR3 Lines[2] = { m_Start, m_End };
m_pD3DXLine->DrawTransform(Lines, 2, &matWorld, m_Color);
It seems to draw the line in screen space.
[edited by - johan_swe on November 12, 2003 1:19:44 PM]
The code:
D3DXMATRIX matWorld;
D3DXMatrixIdentity(&matWorld);
D3DXVECTOR3 Lines[2] = { m_Start, m_End };
m_pD3DXLine->DrawTransform(Lines, 2, &matWorld, m_Color);
It seems to draw the line in screen space.
[edited by - johan_swe on November 12, 2003 1:19:44 PM]
If you want perspective-correct lines, you have to pass your projection matrix, not an identity matrix. Query the device for the projection matrix and pass that to the function.
Ït still doesn''t work...
D3DXMATRIX matProjection;
pDevice->GetTransform(D3DTS_PROJECTION, &matProjection);
D3DXVECTOR3 Lines[2] = { m_Start, m_End };
m_pD3DXLine->DrawTransform(Lines, 2, &matProjection, m_Color);
D3DXMATRIX matProjection;
pDevice->GetTransform(D3DTS_PROJECTION, &matProjection);
D3DXVECTOR3 Lines[2] = { m_Start, m_End };
m_pD3DXLine->DrawTransform(Lines, 2, &matProjection, m_Color);
Have you set up a projection matrix using a D3DXMatrixPerspective*() function followed by a SetTransform() call? If you haven''t set a projection matrix, then querying for one won''t do any good.
When you enumerate devices you can check their caps.
Especially when you use the D3D Framework from the samples you will likely choose the pure device.
But you already said, you checked and it succeeds, so that isn''t your problem.
Especially when you use the D3D Framework from the samples you will likely choose the pure device.
But you already said, you checked and it succeeds, so that isn''t your problem.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement