为什么我在Microsoft.DirectX.Direct3D.Device上出现错误?
本文关键字:错误 Device Direct3D Microsoft DirectX 为什么 | 更新日期: 2023-09-27 18:15:54
整个代码很长。所以我将只在这里添加相关的行。
在表单的顶部:
private Device D3Ddev = null;
Device is 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,版本=7.0.5000.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a'。dopplereffects .cs 467 Active
正如它所述,您需要向程序集'Microsoft.VisualC'添加引用。
搜索"C:'Windows'Microsoft.NET'Framework'v2.0.50727'Microsoft.VisualC.dll"