VertexPositionColor is not coloring
opened this issue · comments
I'm running into a strange problem where I'm following the Simple Rendering tutorial and the triangle is drawing in white instead of yellow or colored. I am also running the 2D sprite batch at the same time, I'm wondering if this might be impacting the primitive batch somehow in this simple example?
This image shows my code, my engine systems make some of these calls simpler.
Many of the effects use different shaders (and therefore different input layouts) depending on the options set. The 'default' shader for BasicEffect does not have per-vertex color enabled, so it won't use "color" in VertexPositionColor.
You need to do:
m_effect = std::make_unique<VertexType>(...);
m_effect->SetVertexColorEnabled(true);
CreateInputLayoutFromEffect<VertexType>(..., m_effect.get(), ...);
This will enable a shader that consumes the per-vertex color.