如此简单的D3D程序,如何会执行不过去
如此简单的D3D程序,怎么会执行不过去?C# codeusing Systemusing System.Collections.Genericusing Syste
如此简单的D3D程序,怎么会执行不过去?
C# codeusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Microsoft.WindowsMobile.DirectX;using Microsoft.WindowsMobile.DirectX.Direct3D;namespace MyFirstDX{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { PresentParameters p = new PresentParameters(); p.Windowed = false; p.SwapEffect = SwapEffect.Discard; Device d = new Device(0, DeviceType.Default,this, CreateFlags.None, p);//这句报错了。 /// } }}
错误如下:
未处理 Microsoft.WindowsMobile.DirectX.Direct3D.InvalidCallException
Message="InvalidCallException"
StackTrace:
at Microsoft.WindowsMobile.DirectX.Direct3D.GraphicsException.ThrowExceptionForHr()
at Microsoft.WindowsMobile.DirectX.Direct3D.CDirect3DMobile.CreateDevice()
at Microsoft.WindowsMobile.DirectX.Direct3D.Device.Init()
at Microsoft.WindowsMobile.DirectX.Direct3D.Device..ctor()
at MyFirstDX.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at MyFirstDX.Program.Main()
何解?????????
[解决办法]试试WM6的模拟器吧,反正我知道不是所有的真机都支持D3D的。
[解决办法]看起来设备不支持 DX?