I've got a starnge error happening in DX9 when I try call DrawIndexedPrimitive().
My vertex declaration is a simple position only declaration, my vertex buffer is a 33 x 33 grid and my index buffer is set up to draw 32 x 32 x 2 triangles - essentially this is a terrain patch. I've been using ID3DXMesh which works fine using the exact same vertex and index buffer setup.
Direct3D9: Decl Validator: X1065: (Element Error) (Decl Element ) Offset must be multiple of DWORD size (4 bytes). Encountered offset: 550
Direct3D9: Decl Validator: X281: (Element Error) (Decl Element ) Usage field contains value that is not a member of D3DDECLUSAGE. Value: 0x26. Aborting decl validation.
the 'Encountered offset' value seems to change each time I run it.
Aside other effect settings, I just call:
graphicsDevice->SetStreamSource(0, vertexBuffer, sizeof(LVec3));
then (for testing I'm just drawing one triangle but supplying the whole vertex buffer):
graphicsDevice->DrawIndexedPrimitive(4, 0, 0, 33 * 33, 0, 1);
Here's my vertex declaration:
LVE* decl_PosOnly = new LVE;
decl_PosOnly = LVE(0, 0, LVE_TypeFloat3, LVE_MethodDefault, LVE_UsagePosition, 0);
decl_PosOnly = LVE_END();
This all essentially resolves down to the exact same structure as a D3DVERTEXELEMENT9
I'm wondering whether I'm writing over some memory somewhere but very little has changed since meshes worked
Anyone seen this error before?