Archived

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

Using Screen coordinates instead of world.

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

Since the search isn''t working, and I looked through the SDK and couldn''t find the exact function, all I need is some quick direction. When I use translate, that''s all in world coordinates. How can I use screen coordinates instead of world? Thanks. --Vic--

Share this post


Link to post
Share on other sites
Well, I guess I should have been more exact in my question. I know how to convert world to screen coordinates. It''s all just a bunch of sin''s and cos''s . But I''m just wondering if there''s a way to save some calc''s and use some kind of translation that draws things directly to the screen. For example, have the translation be in pixels instead of arbitrary units. If not, I guess I can just make up a lookup table to save time. Thanks anyway.

--Vic--

Share this post


Link to post
Share on other sites
It''s all just a bunch of sin''s and cos''s

1) Concatenate the following matrices once for all vertices:
- World
- View
- Projection
- Viewport

2) Transform all vertices (with an added W=1) by that matrix (12 multiplies 12 additions, can be less, also very SIMD friendly).

3) Divide everything by the post transform W


Or you could just use D3DXVec3Project() which does that for you.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites