示例#1
0
void D3DClass::ToggleFillMode()
{
	ID3D11RasterizerState * rState;
	D3D11_RASTERIZER_DESC rDesc;
	
	m_deviceContext->RSGetState(&rState);
	rState->GetDesc(&rDesc);

	rDesc.FillMode = (rDesc.FillMode == D3D11_FILL_SOLID) ? D3D11_FILL_WIREFRAME : D3D11_FILL_SOLID;

	m_device->CreateRasterizerState(&rDesc, &rState);
	m_deviceContext->RSSetState(rState);
}
示例#2
0
void HydGraphics::ToggleWireframe()
{
	m_wireframe = !m_wireframe;

	D3D11_RASTERIZER_DESC rs;
	ID3D11RasterizerState * pRasterState;
	HYD3D_pDevContext->RSGetState(&pRasterState);
	pRasterState->GetDesc(&rs);

	if(m_wireframe)
		rs.FillMode = D3D11_FILL_WIREFRAME;
	else
		rs.FillMode = D3D11_FILL_SOLID;

	HYD3D_pDev->CreateRasterizerState( &rs, &pRasterState );
	HYD3D_pDevContext->RSSetState(pRasterState);
	pRasterState->Release();
}