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:
eng is my engine, and there are NO errors, it runs just fine.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);
Here is my material:
Where buf is my vertex buffer, and yes the material is loaded and applied, I already tested that.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);
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?



LinkBack URL
About LinkBacks


