Problems with material colors

I want to have blocks of basic colors specified with RGB(A). But I can’t get it to work. The colors seems to be distorted.
I use the material technique:


And I set the material for each block as follows:

SharedPtr m = model->GetMaterial()->Clone();
// color contains the specific block color.
m->SetShaderParameter(“MatDiffColor”,Vector4(color.x_/255.0f, color.y_/255.0f, color.z_/255.0f, 1.0f));

The result becomes like this (the physic-blocks):

I want the blocks to have the same colors as the original blocks in the world. But as seen the blocks are multicolored and not one color.

What am I missing here?

Use you standat Box.mdl or own model? May be in model no vertex colors? Try “NoTexture” technique instead

I’m using the standard asset “Models/Box.mdl”. It worked with using the NoTexture tech. Many thanks!