【发布时间】:2016-11-01 00:38:44
【问题描述】:
整个代码很长。 因此,我将仅在此处添加相关行。
在表格顶部:
private Device D3Ddev = null;
设备是 Microsoft.DirectX.Direct3D.Device
然后:
private Boolean InitializeDirectX()
{
DispMode = Manager.Adapters[Manager.Adapters.Default.Adapter].CurrentDisplayMode;
D3Dpp = new PresentParameters();
D3Dpp.BackBufferFormat = DispMode.Format;
D3Dpp.PresentFlag = PresentFlag.LockableBackBuffer;
D3Dpp.SwapEffect = SwapEffect.Discard;
D3Dpp.PresentationInterval = PresentInterval.One; //wait for vertical sync. Synchronizes the painting with
//monitor refresh rate for smoooth animation
D3Dpp.Windowed = true; //the application has borders
try
{
D3Ddev = new Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, pictureBox1.Handle,
CreateFlags.SoftwareVertexProcessing, D3Dpp);
D3Ddev.VertexFormat = CustomVertex.PositionColored.Format;
D3Ddev.RenderState.Lighting = false;
D3Ddev.RenderState.CullMode = Cull.CounterClockwise;
backTexture = TextureLoader.FromStream(D3Ddev, mymem);
scannedCloudsTexture = new Texture(D3Ddev, 512, 512, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
//sprite is used to draw the texture
D3Dsprite = new Sprite(D3Ddev);
return true;
}
catch
{
Logger.Write("error");
return false;
}
}
错误就行了:
D3Ddev.VertexFormat = CustomVertex.PositionColored.Format;
关于格式。
严重性代码描述项目文件行抑制状态 错误 CS0012 类型“IsConstModifier”在未引用的程序集中定义。您必须添加对程序集“Microsoft.VisualC, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”的引用。 DopplerEffect.cs 467 活动
【问题讨论】:
-
托管 DirectX 库非常非常古老,并且在 .NET 2.0 发布之前就停止了。微软不再想支持它,那不是因为它是一个很棒的库。你缺少一个依赖,回到 Visual Studio 2002。继续使用这个库的开源替代品,比如 SharpDX 和 SlimDX。