Hello, I am trying to get ambient lighting working in my application to highlight my models/meshes with a certain color. It seems to be working fine with D3DCREATE_SOFTWARE_VERTEXPROCESSING, but when I switch the device creation code to use D3DCREATE_HARDWARE_VERTEXPROCESSING, I don't get any ambient lighting on my models. Here is the code I use for the ambience:
m_displayDevice->SetRenderState( D3DRS_LIGHTING, true );
m_displayDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_XRGB( 255, 0, 0 ) ); // hardcoded to red for this example
m_displayDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
m_displayDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_displayDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_COMPLEMENT );
Oh, and yes, I have this check in my device code (so I'm not just blatantly using hardware processing without it being available :)
if ( d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
{
vertexProcessing = D3DCREATE_HARDWARE_VERTEXPROCESSING;
}
Is there anything blatantly wrong with what I am trying to do? Any suggestions?