I need to draw lines using DrawPrimitiveUP and I need it to use the color value from my defined structure.
Important snippets from the code:
struct PointVertexColor
{
float x, y, z; // Position
DWORD color; //Colour
};
#define D3DFVF_PointVertexColor ( D3DFVF_XYZ | D3DFVF_DIFFUSE )
PointVertexColor myLines[1024];
device->DrawPrimitiveUP( D3DPT_LINELIST, myLinesCount, myLines, sizeof( PointVertexColor ) );
I have a pointlight set, lighting enabled and ambient lighting also.
Problem is that if I set up a material it uses the materials color and not the one from my data struct. How do I set it up so it uses the DWORD color and then set it back to use material for later code ?
The problem was obvious if you know it – you can’t use vertex color and lighting at the same time. The solution is to disable lighting for that part of the code and then re-enable it later.
Hope it helps someone with the same question.