• Advertisement

Archived

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

Converting 3D Coordinates to Screen Coordinates

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

  • Advertisement