According to your error message:
X284: (Element Error) (Decl Element [3]) Declaration can't map to fixed function FVF because a usage+index pair (D3DDECLUSAGE_TANGENT,0) that is not valid for fixed function appears between two vertex elements that have usage+index pairs valid for fixedfunction. For a vertex declaration to map to fixed function, all individualelements that are valid for fixed function must appear contiguously starting from the first element. Remaining elements at the end do not have to be valid for fixed function, as long as there are few enough that they can be aliased internally to texcoord(n), texcoord(n+1) etc. up to max. texcoord7 (thereby appearing to conform to an FVF, although the aliased values should not be used).
your mesh contains data about the vertex tangents. This vertex property apparently is not supported by the fixed function pipeline. Reading further in the error message (I'd wish I'd get such verbose error messages as this one [smile]), this is no problem is itself, but D3D sees that the declaration does define properties it can handle after this tangent element. That's what it complains about, since it seems to require that all elements it supports (position normal, uv etc) are defined contiguously before any unsupported element are defined (with a maximum of 8 ignored unsupported elements). So basically your vertex declaration looks like this:
- supported element- supported element* unsupported tangent- supported element
while the FVF/fixed function pipeline requires it to look like this:
- supported element- supported element- supported element* unsupported tangent
Now, as for how to fix this, you basically have 3 options:
- Use a HLSL effect/shader for your rendering
- Remove the tangent definition from the model in your modelling packages
- Write code to re-arrange or remove the tangent element
If you're not going to use the tangent information, the last option is probably just a waste of time. Now, if you want to use the tangent information (for normal mapping for example), biting the bullet and switching to shaders is probably the best way to go. If you don't need the tangent anyway, your modelling package should allow you to customize the export settings so it doesn't save out this data and it doesn't show up in the vertex declaration.
Hope this helps :)