以下答案仅供参考,有错欢迎留言。
Chapter 9 : Blending
1. Modify the “Transparent Water” demo by using the following line before drawing the water:
md3dImmediateContext->OMSetBlendState(TransparentBS, blendFactors, 0xfffffffe);
This turns off the first bit which disables the first sample. Because we are not using multisampling (which is like using multisampling with one sample), this prevents the water pixels from being drawn.
在创建交换链时,程序中mEnable4xMsaa默认为false,不使用多重采样,采样器Count = 1。
// Use 4X MSAA?
if( mEnable4xMsaa )
{
sd.SampleDesc.Count = 4;
sd.SampleDesc.Quality = m4xMsaaQuality-1;
}
// No MSAA
else
{
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
}
Blend Demo中的mEnable4xMsaa值为false,默认不使用多重采样,故采样器只有1个,由OMSetBlendState的第三个参数UINT SampleMask的第1位控制采样器开关,第1位取0以后即表示不绘制。
md3dImmediateContext->OMSetBlendState(RenderStates::TransparentBS, blendFactor, 0x00000000); //同0xfffffffe