Sign in to follow this  
ProblemBaby

Software Transform problem

Recommended Posts

ProblemBaby    122
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
Sc4Freak    643
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this