When I apply a material that has a specular values, my cube (wich is made from multi colored vertices) turns pure yellow/green.
Here is my light:
Code:
eng.SetLighting(true);
eng.GetDevice()->SetRenderState(D3DRS_SPECULARENABLE, true);
eng.GetDevice()->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
LIGHT light;
ZeroMemory(&light, sizeof(light));
light.Type = D3DLIGHT_POINT;
light.Position.x = 0;
light.Position.y = 5;
light.Position.z = 0;
light.Diffuse.r = 1;
light.Diffuse.g = 1;
light.Diffuse.b = 1;
light.Diffuse.a = 1;
light.Attenuation0 = 1;
light.Range = 20;
light.Specular.r = 1.0f;
light.Specular.g = 1.0f;
light.Specular.b = 1.0f;
light.Specular.a = 1.0f;
eng.LightAdd(0, light);
eng.LightEnable(0, true);
eng is my engine, and there are NO errors, it runs just fine.
Here is my material:
Code:
MATERIAL mat;
ZeroMemory(&mat, sizeof(mat));
mat.Specular.r = 0.5f;
mat.Specular.g = 0.5f;
mat.Specular.b = 0.5f;
mat.Specular.a = 0.5f;
mat.Power = 20.0f;
buf.SetMaterial(mat);
Where buf is my vertex buffer, and yes the material is loaded and applied, I already tested that.
The problem is, if I take away the buf.SetMaterial(...) line of code it works fine but without the specular effects. Any idea why this is happening?