• Advertisement
Sign in to follow this  

Software Transform problem

This topic is 3962 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Iam trying to do a software transformation, but I never got correct output right now it looks like this: <code> D3DXVECTOR4 Vector(x, y, z, 1); D3DXMATRIX ViewportMatrix(ScreenWidth, 0, 0, 0, 0, -ScreenHeight, 0, 0, 0, 0, 1.0f, 0, 0, ScreenHeight, 0, 1); D3DXVec4Transform(&Vector, &Vector, &ViewMatrix); D3DXVec4Transform(&Vector, &Vector, &ProjMatrix); D3DXVec4Transform(&Vector, &Vector, &ViewportMatrix); rx = (int)(Vector.x / Vector.w); ry = (int)(Vector.y / Vector.w); <\code> can someone point out something that is wrong it would be great!

Share this post


Link to post
Share on other sites
Advertisement
Instead of doing it manually, you might want to have a look at D3DXVec3Project(). It takes world, view, projection and viewport data in and does the calculation for you. Using this function should reduce the chance for error somewhat.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
thank you very much

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement