Screen Space and World Space
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.
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement