|
该显卡不支持定点和像素着色器,请问该如何初始化DEVICE?
代码如下:
static void InitializeGraphics()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentationInterval = PresentInterval.One;
Microsoft.DirectX.Direct3D.Caps hardware = Microsoft.DirectX.Direct3D.Manager.GetDeviceCaps(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware);
CreateFlags flags = CreateFlags.SoftwareVertexProcessing;
if (hardware.DeviceCaps.SupportsHardwareTransformAndLight)
flags = CreateFlags.HardwareVertexProcessing;
if (hardware.DeviceCaps.SupportsPureDevice)
flags |= CreateFlags.PureDevice;
try
{
dGDevice = new DGDevice(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, m_GameWindow, flags, presentParams);
}
catch(Exception e)
{
MessageBox.Show(e.ToString()+" 使用参考光栅");
dGDevice = new DGDevice(0, Microsoft.DirectX.Direct3D.DeviceType.Reference, m_GameWindow, flags, presentParams);
}
dGDevice.RenderState.ReferenceAlpha = 0;
dGDevice.RenderState.AlphaFunction = Compare.NotEqual;
DXSprite = new D3DSprite(Game.Device);
}
总是在创建DEVICE的时候报错,错误报告如下:
Error in the application.
-2005530516 (D3DERR_INVALIDCALL)
at Microsoft.DirectX.Direct3D.Device..ctor(Int32 adapter, DeviceType deviceType, Control renderWindow, CreateFlags behaviorFlags, PresentParameters[] presentationParameters) at CardGame.Engine.Game.InitializeGraphics() 使用参考光栅
参考光栅也过去不,大家帮我看看~~ |
|