How to use materials on my mesh?

Started by
13 comments, last by johnnyBravo 20 years, 8 months ago
you can set the materialdiffuse by using a number between 0.0 and 1.0.

.lick
Advertisement
hmm i tried that, but nothing seems to happen, just the colour with a value larger than 0 shows the whole colour.
actually i tried that on the microsoft sdk example and it did work...., could it b i have the light too close to the surface?
ok, i think my point lights setup wrong.

When i turned the point light off, and just set ambient light on, the materials worked properly, like 0.5 for red worked, u could see the difference.

anyway could you have a look at this point light and see if there is any reason it won''t show anything but the max colour for the rgb

		void PointLight(int index, float x, float y, float z, float range, float r , float g, float b, float a0=0, float a2=0)		{			D3DXVECTOR3 vecDir;			D3DLIGHT9 light;			ZeroMemory( &light, sizeof(D3DLIGHT9) );			light.Type       = D3DLIGHT_POINT ;			light.Diffuse.r  = r;			light.Diffuse.g  = g;			light.Diffuse.b  = b;			light.Attenuation0 =a0;			light.Attenuation2 =a2;			light.Position= D3DXVECTOR3( x, y, z );			light.Range       = range;			myDevice->SetLight( 0, &light );		}


I finally worked out how to set the material to my mesh.

The mesh already had a material set to it. So i just removed that line, and i could use my main material code to set that aswell.

This topic is closed to new replies.

Advertisement