I'm kind of new to this, what does VPOS mean?
I set the view and projection matrices when initializing Direct3D. Then when rendering I do this:
World = i->second->getTransform() * m_BufferToWorld;
hr = m_pD3DDevice9->SetTransform(D3DTS_WORLD, &World);
The buffer to world matrix is used because I use buffer-space coordinates to define the vertices in my polygons.
Here's the code I'm using to convert from object coordinates to window coordinates:
D3DXMATRIX matProj;
D3DXMATRIX matView;
hr = m_pD3DDevice9->GetTransform(D3DTS_PROJECTION, &matProj);
hr = m_pD3DDevice9->GetTransform(D3DTS_VIEW, &matView);
D3DXMATRIX mWorldView = obj->getTransform() * m_BufferToWorld * matView * matProj;
multiplyMatrixVector(mWorldView, Coord);
Coord /= Coord.w;
This should give me world coordinates, right? Nothing comes out right this way. If I leave out the projection matrix, I get x, y coordinates that are fine (for an orthogonal projection), but the z coordinate is always off.