1) Does your WorldViewProj matrix work as expected?
- If so, are you updating that through the constant table as well?
- If you are, compare where in your program the update is being done with the update of the ambient parameter.
2) Does the constant table definately match the shader? i.e. is it generated from compilation at runtime or is it loaded from disk (for example).
3) Does SetFloatArray() return an error at all? - link with the debug version of D3DX to be 100% certain.
4) Are you trying to use the effect system at the same time as constant tables?.
5) I suspect this is either an order issue (e.g. changing the ambient colour /after/ the draw call, or an API call error, or
------------8<---- snip - aaaaaarghh - just spotted something:6)
Quote:ConstantTable->SetFloatArray(gD3DDevice, "Ambient", Ambient, 4);
Take another look at the documentation for ID3DXConstantTable::SetFloatArray. You'll notice that the second parameter is a
D3DXHANDLE; this should be a **handle** to a variable **NOT** a string!
You should do:
D3DXHANDLE hAmbient = ConstantTable->GetConstantByName(NULL, "Ambient);
...
ConstantTable->SetFloatArray(device,
hAmbient, Ambient, 4);
Don't make assumptions about the API based on the base type of "handles" - if the docs don't say the function takes a string; then the function doesn't take a string!.
The API will have returned an error from SetFloatArray() in the above situation though - the debug version of D3DX and checking error returns is a good thing :)