Skip to main content
gamedev.net
🔒 Locked

Software Transform problem

Started by ProblemBaby 1 reply 850+ views
Original Post
ProblemBaby
ProblemBaby
Iam trying to do a software transformation, but I never got correct output right now it looks like this: 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!
Problems every where
Sc4Freak
Sc4Freak
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.