关于SetFVF()中的D3DFVF_TEX[N]

Posted on 2008-10-25 13:06  活着就是幸福  阅读(907)  评论(0编辑  收藏  举报
如果SetFVF()里用了D3DFVF_TEX[N]的话,等于前面的D3DFVF_TEX[N-1]都设置过了,在写

vertex declaration的时候,也要把相应的tex写上.GameDev上各位Gurus回答的原文摘抄如下:

1. D3DFVF_TEXCOORD2 counts as "this vertex has TWO texcoordinates". It's not "This vertex has the texcoord at index 2".

2.the FVF and what the technique wants don't have to match EXACTLY. The FVF (or vertex declaration, whichever you use) has to have all of the elements that the technique wants. It can also have more. If the technique only uses texcoord0, but your FVF has more than one texcoord, that's just fine, because texcoord0 DOES exist in your format. Similarly, if your FVF is D3DFVF_XYZ|D3DFVF_NORMAL and the technique only uses Position, you're totally fine - the normal being in your vertex doesn't hurt anything, it's just not being used by that technique.
It's when you are missing something from the vertex format that the technique wants that it's a problem - if the technique is looking for normal and all you have is D3DFVF_XYZ|D3DFVF_COLOR, it won't work. YOu'd need to add D3DFVF_NORMAL to it.

3.When using XYZRHW, the vertex shader is skipped, and the position, color, and texcoords will be passed directly to the rasterizer, and pixel shader. Use XYZW to call the vertex shader.

 PS: CSDN上的游戏开发分论坛进去一看大多是招聘和扯皮的,看来什么也得不到.国内和国外的论坛氛围差这么多么?