Screen Space and World Space

Started by
4 comments, last by tenchimusakiryoko 20 years, 3 months ago
Hey everyone, just wondering, if im drawing my 3d world in...well, 3d, how would i draw something 2d to the screen space, like a HUD. thx.
"Good,evil,I got the gun"Ash- Evil Dead
Advertisement
You have to create a separate vertex type, which actually extends into 4D. Mine looks like this:

struct VERTEX2D
{
D3DXVECTOR4 position;
float tu, tv;
};

and the FVF is:

D3DFVF_XYZRHW | D3DFVF_TEX1

You can then just use four of these vertices and map your HUD texture over them.
yay, i got it thx so much
"Good,evil,I got the gun"Ash- Evil Dead
Can you please explain why this works? I''m having similar trouble... (and yes, I''m sorry to bring up an old thread)
...

The fourth component is not a "4th dimension" it is the rhw. To make things simple, it signals that everything you give it is post-transformation. It will not do the calculations for lighting or vertex position. The xyz will be in pure pixels. Just set the rhw to 1 to keep it from doing any weird scaling.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Ah, I get it now. Thanks a lot

This topic is closed to new replies.

Advertisement