本文主要是介绍龙书D3D11章节习题答案(第九章),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
以下答案仅供参考,有错欢迎留言。
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 MSAAelse{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
这篇关于龙书D3D11章节习题答案(第九章)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!