• Advertisement
Sign in to follow this  

Difference between D3DFVF_XYZW and D3DFVF_XYZRHW

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

Hi, who can tell me the difference? I searched but could not find any useful info. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
From the DXSDK Documentation
D3DFVF_XYZRHW - Vertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags.
D3DFVF_XYZW - Vertex format contains transformed and clipped (x, y, z, w) data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline.

That should clarify the difference. Both are transformed coordinates but the latter are also clipped; i. e. one step further down the road to the screen.

Share this post


Link to post
Share on other sites
Formats containing D3DFVF_XYZRHW will not pass through the vertex pipeline at all. D3DFVF_XYZW, on the other hand, will go through the vertex shader. It's essentially the same as an XYZ vertex but with a further component. I'm not sure what the comment in the D3DFVF docs page means, but it's probably specific to ProcessVertices.

Share this post


Link to post
Share on other sites
D3DFVF_XYZRHW: Use that when you need to work in screenspace (in 2D, for example for UIs and stuff like that) The vertex shader / pipeline won't be applied to those vertices. Only the pixel shader / pipeline. x and y contain the x and y coordinate of the vertex in screenspace, and z and w contain the depth information (never remember how its stored)

D3DFVF_XYZW: Use that ONLY if you're using a vertex shader which needs a float4 as the POSITION input. This FVF code won't work with the fixed pipeline.


With the 3 answers, I think you've got your answer :) (although you didn't tell use why you need to know the difference :p)

Share this post


Link to post
Share on other sites
I saw some code written with the D3DFVF_XYZW, whick also works well. So I'd like to understand the difference. Thanks very much.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement