Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6915 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

Hi, i''ll call u CG!! well i have a small problem in the code u gave me for finding the 2d coords of an object. D3DMATRIX Temp; D3DMATRIX Final; float XTemp; float YTemp; float ZTemp; float WTemp; float RW; Temp = WorldMatrix * ViewMatrix; Final = Temp * ProjMatrix; // if X,Y,Z are the coordinates of the object // in world space: XTemp = (Final._11 * X) + (Final._21 * Y) + (Final._31 * Z) + Final._41; YTemp = (Final._12 * X) + (Final._22 * Y) + (Final._32 * Z) + Final._42; ZTemp = (Final._13 * X) + (Final._23 * Y) + (Final._33 * Z) + Final._43;WTemp = (Final._14 * X) + (Final._24 * Y) + (Final._34 * Z) + Final._44;RW = 1.0f / WTemp; ScreenX = (1.0f + (XTemp * RW)) * ScreenWidth / 2.0f; ScreenY = (1.0f - (YTemp * RW)) * ScreenHeight / 2.0f; ScreenZ = ZTemp * RW;ScreenW = WTemp; 1> when i''m in 640x480 i have to specify ScreenX = 640 - ScreenX for gettin my output. 2> the ScreenY values are all screwed up but they are kinda relative. ScreenX = (1.0f + (XTemp * RW)) * ScreenWidth / 2.0f; ScreenY = (1.0f - (YTemp * RW)) * ScreenHeight / 2.0f; in the above two lines why do you do (1.0f + (blah)) & (1.0f - (blah))??? what is 1.0???why do u finally divide by 2??? I need some help desparetely! please help me out/ and about the MSDN sample u had talked about,which sample r u refering to??is it available online???? thnx for sparing ur time!! sandeep_kl@mailcity.com

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!