Converting 3D Coordinates to Screen Coordinates

Started by
2 comments, last by Yaskil 20 years, 9 months ago
how can i convert 3d coordinates to screen coordinates???
Life is beautiful
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.
- Just another sad bastard
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]
Life is beautiful
hi - the D3DXVec3Project function will convert 3d coordinates to screen space coords.

hope this helps-

BM

This topic is closed to new replies.

Advertisement