Original Post
I''ve been chewing on DX9 for a bit, and think I''ve uncovered an ambiguity for vertex declaration, or an error in the documentation. The question, in short, is how D3DVERTEXELEMENT9.Offset gets used:
I understand it''s a byte offset per vertex element, but does it span streams? In other words, if stream 0 has spatial and color elements, color coming second would have a 12 byte offset in its vertex declaration:
However, if we split spatial and color elements into their own stream, does the offset still occur, or it restarts to 0:
It seems to happen both ways in the documentation.
With: DXGraphics->Programming Guide->Programmable Pipeline->Programmable Stream Model
Without: DXGraphics->Programming Guide->Programmable Pipeline->Programmable Stream Model->ColorVertex Shader
Any insight, guys?
Thanks,
Schpok
D3DVERTEXELEMENT9 decl[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
D3DDECL_END()
};
D3DVERTEXELEMENT9 decl[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 1, 0, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
D3DDECL_END()
};