Difference between D3DFVF_XYZW and D3DFVF_XYZRHW

Started by
3 comments, last by wswqwps 15 years, 8 months ago
Hi, who can tell me the difference? I searched but could not find any useful info. Thanks.
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.
Hack my projects! Oh Yeah! Use an SVN client to check them out.BlockStacker
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.
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)
I saw some code written with the D3DFVF_XYZW, whick also works well. So I'd like to understand the difference. Thanks very much.

This topic is closed to new replies.

Advertisement