日期:2014-05-19  浏览次数:21013 次

Direct3D的Device老是出现InvalidCallException异常
我参照MSDN上的示例代码,创建Direct3D的Device对象:

PresentParameters   presentParams   =   new   PresentParameters();
       
//   Don 't   run   full   screen
presentParams.Windowed   =   true;
       
//   Discard   the   frames
presentParams.SwapEffect   =   SwapEffect.Discard;
       
//   Instantiate   a   device
device   =   new   Device(0,
DeviceType.Reference,
this,                                 //表单对象
CreateFlags.SoftwareVertexProcessing,
presentParams);

按照道理,DeviceType.Reference无论如何都会被支持。但是一直在构造时出现
InvalidCallException异常。请问各位高手怎么回事啊?

望大侠们不吝赐教,先谢了!!


------解决方案--------------------
你建立工程的时候是选的Direct3D项目么?另外你这段代码加在什么地方的