Vertex blend error!!!!

Started by
1 comment, last by RealRender 19 years, 5 months ago
i am crazy with my vertex blend.. this is my vertex define.. struct Vertex { enum{ FVF = D3DFVF_XYZB1 | D3DFVF_LASTBETA_UBYTE4 | 3DFVF_NORMAL | D3DFVF_TEX1 }; D3DXVECTOR3 p; union { float beta; BYTE indices[4]; }; D3DXVECTOR3 n; float tu, tv; }; and before render it i set the renderstate as: SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, TRUE ); SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_0WEIGHTS ); but when i render: SetFVF(Vertex::FVF) SetStreamSource(........) DrawPrimitive........ when call DrawPrimitive ,,,i get an error in debug window : Direct3D9: (ERROR) :The number of blend weights in the FVF should match what is set in D3DRS_VERTEXBLEND for indexed vertex blending why ??? anybody can help me? thanks.
Advertisement
try setting D3DVBF_1WEIGHTS instead of D3DVBF_0WEIGHTS...
see the directx document:

D3DVBF_DISABLE
Disable vertex blending; apply only the world matrix set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation state is 0.

D3DVBF_1WEIGHTS
Enable vertex blending between the two matrices set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation states are 0 and 1.


D3DVBF_0WEIGHTS
Use a single matrix with a weight of 1.0.


my vertex only has one weight of 1.0, and have to set to D3DVBF_0WEIGHTS

and i tried D3DVBF_1WEIGHTS, i still have this error too.

This topic is closed to new replies.

Advertisement