我正在尝试制作一个非常简单的应用程序,它会在每只眼睛上显示不同的图像.我有华硕VG236H显示器和NVIDIA 3D Vision套件,立体3D快门眼镜.我正在使用C#,.NET Framework 2.0,DirectX 9(Managed Direct X)和Visual Studio 2008.我一直在寻找示例和教程的高低,实际上找到了一对,并且基于我创建的程序但是由于某种原因,我不能让它工作.
在寻找如何为每只眼睛显示不同图像的示例时,许多人不断参考GDC 09(着名的GDC09-3DVision-The_In_and_Out.pdf文档)和第37-40页的NVIDIA演示文稿.我的代码主要是基于这个例子构建的:
当我运行程序时,快门眼镜开始工作,但我只能在屏幕上并排看到这两个图像.有人可以帮忙告诉我我做错了什么吗?我相信解决这个问题也可能有助于其他人,因为似乎还没有一个简单的例子如何用C#做到这一点.
以下是我的代码的战术部分.完整的项目可以在这里下载:http://koti.mbnet.fi/jjantti2/NVStereoTest.rar
public void InitializeDevice()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = false;
presentParams.BackBufferFormat = Format.A8R8G8B8;
presentParams.BackBufferWidth = _size.Width;
presentParams.BackBufferHeight = _size.Height;
presentParams.BackBufferCount = 1;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentationInterval = PresentInterval.One;
_device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
}
public void LoadSurfaces()
{
_imageBuf = _device.CreateOffscreenPlainSurface(_size.Width * 2, _size.Height + 1, Format.A8R8G8B8, Pool.Default);
_imageLeft = Surface.FromBitmap(_device, …Run Code Online (Sandbox Code Playgroud)