Using Screen coordinates instead of world.

Started by
3 comments, last by Roof Top Pew Wee 21 years, 6 months ago
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--
Advertisement
Either use Transformed vertices or use an Orthographic projection (no docs handy, something like D3DXOrthoOffsetLH).


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
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--
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Right on! I was just looking how to do this last night myself.

This topic is closed to new replies.

Advertisement