7
D3D11的api似乎有點笨拙,或者我沒有正確使用它。更改D3D11中的單個狀態設置
這是真的,這是步驟更改D3D11一個光柵化狀態(我的變化來線框模式渲染爲例)的最小集合
// variables to hold the current rasterizer state and its description ID3D11RasterizerState * rState ; D3D11_RASTERIZER_DESC rDesc ; // cd3d is the ID3D11DeviceContext cd3d->RSGetState(&rState) ; // retrieve the current state rState->GetDesc(&rDesc) ; // get the desc of the state rDesc.FillMode = D3D11_FILL_WIREFRAME ; // change the ONE setting // create a whole new rasterizer state // d3d is the ID3D11Device d3d->CreateRasterizerState(&rDesc, &rState) ; cd3d->RSSetState(rState); // set the new rasterizer state
看來很多長於9的
cd3d->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME) ;
不要忘記在調用RSSetState後釋放您的rState實例以避免內存泄漏。 – mchiasson