多重采样不以独占模式工作 [英] Multisampling doesn't work in exclusive mode
问题描述
我想在下面的图片绘制三角形一样时启用多重采样:
I would like to enable multisampling when drawing triangles like on the following picture:
我找到了一种方法中的 SlimDX 的=http://stackoverflow.com/questions/12351424/ 。启用-antialising功能于slimdx-D3D9>另一个问题但它并不以独占模式工作
I found a way to do with SlimDX in another question but it doesn't work in exclusive mode.
下面是我的代码:
void Form1_Load(object sender, EventArgs e)
{
Direct3D d3d = new Direct3D();
PresentParameters presentParams;
presentParams.Windowed = false;
presentParams.BackBufferFormat = Format.X8R8G8B8;
presentParams.BackBufferWidth = 800;
presentParams.BackBufferHeight = 600;
presentParams.FullScreenRefreshRateInHertz = 60;
presentParams.SwapEffect = SwapEffect.Copy;
presentParams.BackBufferCount = 1;
presentParams.PresentationInterval = PresentInterval.One;
int multisampleQuality;
Result result;
if (d3d.CheckDeviceMultisampleType(adaptor, DeviceType.Hardware, Format.X8R8G8B8, false, MultisampleType.FourSamples, out multisampleQuality, out result))
{
if(multisampleQuality > 4)
{
presentParams.Multisample = multisampleType;
presentParams.MultisampleQuality = 4;
}
}
// Device creation
Device device = new Device(d3d, adaptor, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, presentParams);
}
最后一行送花儿给人以 D3DERR_INVALIDCALL 错误crashs即使的 CheckDeviceMultisampleType 的返回总是正确的,没有错误和8的 multisampleQuality 的
The last line alway crashs with a D3DERR_INVALIDCALL error even if the CheckDeviceMultisampleType return always true with no error and 8 for multisampleQuality.
它的工作原理,如果我使用窗口模式或如果我删除了多重采样选项。
It works if I use the windowed mode or if I remove the multisample option.
谁能告诉我什么是错的?
Can someone tell me what's wrong?
推荐答案
与尝试
presentParams.SwapEffect = SwapEffect.Discard;
这篇关于多重采样不以独占模式工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!