Render States
DirectX encapsulates many rendering options elegantly in a single interface: the render states. This consists of a single call that can modify dozens of rendering settings, such as fog, alpha-blending and testing, and so on. This way coding is greatly simplified. For example, here is the line required to set alpha-blending:
pd3dDevice8->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pd3dDevice8->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
A similar call can be used to specify parameters like the point size, with the line:
pDevice9->SetRenderState(D3DRS POINTSIZE, 5);
Render states are documented thoroughly in the DirectX SDK. They are listed in the D3DRENDERSTATETYPE structure. Just remember that some state changes are costly and should thus be handled with care.
|