Faelenor said:
Hi!
In DirectX, I tried to turn the lighting off, but I don't know how to define the color. In the doc, it seems that we have to define a vertex color for each vertex, but I think that it's a waste of memory, because the color is constant... Do you know how to do that?
Francis
You weren't exceptionally clear on what you wanted, but assuming I've figured it out, here's the deal.
First, if you turn off lighting, there are no lights - no materials, etc. No need to set any of that stuff, and it will confuse you if you do.
If you want all faces to be a particular color, then you can use a TFactor. I'm not exactly sure how this is done in MDX (C#) but in C++, it looks something like the following:
Device->SetRenderState(D3DRS_TEXTUREFACTOR, (DWORD) colorYouWant);
Device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
Device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
That is the FFP version anyway...
Additionally, you could write some vertex shaders and then write the colors into the shader even though it wasn't stored in the stream.