Jump to content
  • Advertisement

Archived

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

Yaskil

Converting 3D Coordinates to Screen Coordinates

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

Advertisement
What do you mean by 3D coords?

Untransformed vertex (local coordinates) needs to go through world transformation, view transformation and projection matrices. I don''t have the sdk handy right now but I bet it''s there explained with a lot more details.

Share this post


Link to post
Share on other sites
i.e i have a tile with local coords (0.1234, 1.4321, 5.1234) and built up with following vertexes (untransformed and unlit)


p1 = D3DXVECTOR3(0,0,0);
p2 = D3DXVECTOR3(3,0,0);
p3 = D3DXVECTOR3(0,0,3);
p4 = D3DXVECTOR3(3,0,3);

so the tile will be

screen
|
|
|
------------------------------------------------------------
|
|
| p1 p2
| .----------.
| triangle1<-- | / |
| | / |
| | / | --> triangle 2
| .----------.
| p3 p4
|
|
|
|
------------------------------------------------------------



so how can i calculate which pixels are used by this square?

[edited by - yaskil on July 28, 2003 8:32:31 AM]

Share this post


Link to post
Share on other sites
hi - the D3DXVec3Project function will convert 3d coordinates to screen space coords.

hope this helps-

BM

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!