Archive for October, 2009

light & material

Tuesday, October 13th, 2009

declare a light struct and a material struct (D3DLIGHT9 & D3DMATERIAL9)
use the device object’s SetRenderState method to enable lighting
use the device object’s SetLight() to apply the specific D3DLIGHT9 struct
->LightEnable()

declare a D3DMATERIAL9 struct and then initialize it
use the device object’s SetMaterial() method to use  the specific material before draw the target object

paint step

Tuesday, October 13th, 2009

create a object(LPD3DXMESH)  (D3DXCreateXXX)
set up the view matrix(D3DXMATRIX),camera position(D3DXVECTOR3),look position and direct(D3DXMatrixLookAtLH)
set up the world matrix (D3DXMatrixTranslation)
apply the world matrix to the device object use SetTransform
draw the object .eg. teapot->DrawSubset(0)
end scene
present