This topic is now archived and is closed to further replies.


Need help with setting up lightning

Recommended Posts

Hi! I have created a point light in d3d that doesn''t seem to work properly. It doesnt matter what values I put in the d3dlight structure the light doenst change, it just lits up the screen. For example if I alter the lightrange nothing happends. This has annoyed me for sometime now and I just can''t figure it out. Have I missed something?
	ZeroMemory( &material, sizeof( D3DMATERIAL8 ) );
		material.Diffuse = D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f );


	D3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
	ZeroMemory(&d3dlight, sizeof( D3DLIGHT8 ) );
		d3dlight.Type = D3DLIGHT_POINT;

		d3dlight.Diffuse  = D3DXCOLOR( 0.5f, 0.5f, 0.5f, 0.5f );

		d3dlight.Position = D3DXVECTOR3( 0.0f, 0.0f, -1.0f );
		d3dlight.Range = 200.0f;

	D3dDevice->SetLight( 0, &d3dlight );
	D3dDevice->LightEnable( 0, TRUE ); 


Share this post

Link to post
Share on other sites