views:

157

answers:

1

What might stop IDirect3DDevice9::SetTransform from working? I've looked at alot of tutorials for using transformation matrices in Direct3D9, including this one here. And as far as I can tell, they all do it the same way.

I'm trying to write some code just to translate a texured polygon. I call SetTransform with a matrix initialized with D3DXMatrixTranslation, and it returns S_OK. However the actual polygons drawn to the screen do not get transformed.

D3DXMATRIX m_Translation;
D3DXMatrixTranslation(&m_Translation,100,100,0);
d3dDevice->SetTransform(D3DTS_WORLD, &m_Translation);

d3dDevice->SetFVF(D3DFVF_TLVERTEX);
d3dDevice->SetStreamSource(0, vertexBuffer, 0, sizeof(TLVERTEX));

HRESULT hr = d3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
+2  A: 

You set "D3DFVF_TLVERTEX" which means that you are supplying "Transform and Lit" vertices in the vertex buffer, therefore the device is not going to apply a transformation matrix to these vertices.

gatorfax
Yes that was it, apparently Transformed also means "and unable to be transformed furthur".
Kevin Laity