設定底紋模式 (Direct3D 9)
Direct3D 可一次選取一個底紋模式。 根據預設,選取 [古勞德底紋]。 在C++中,您可以呼叫 IDirect3DDevice9::SetRenderState 方法來變更底紋模式。 將 State 參數設定為 D3DRS_SHADEMODE。 State 參數必須設定為 D3DSHADEMODE 列舉的成員。 下列範例程式代碼範例說明 Direct3D 應用程式的目前底紋模式如何設定為平面或 Gouraud 底紋模式。
// Set to flat shading.
// This code example assumes that pDev is a valid pointer to
// an IDirect3DDevice9 interface.
hr = pDev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_FLAT);
if(FAILED(hr))
{
// Code to handle the error goes here.
}
// Set to Gouraud shading. This is the default for Direct3D.
hr = pDev->SetRenderState(D3DRS_SHADEMODE,
D3DSHADE_GOURAUD);
if(FAILED(hr))
{
// Code to handle the error goes here.
}
相關主題