1
尝试创建D3d设备时出现未处理的异常。DirectX InvalidCallException未处理
这实际上是C#中的整个代码。我只是在测试并试图学习directx。 我收到这条线 未处理的异常:device = new Device(0, DeviceType.Hardware, this,CreateFlags.SoftwareVertexProcessing, presentParams);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Device device = null; // Create rendering device
PresentParameters presentParams = new PresentParameters();
device = new Device(0, DeviceType.Hardware, this,CreateFlags.SoftwareVertexProcessing, presentParams);
RenderToSurface render = new RenderToSurface(device, 300, 300, Format.D32, true, DepthFormat.D32);
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
吹我的脑海里,因为它看起来像所有PARAMS是正确的类..
这很奇怪......这应该适用于基于表单的应用程序,对吧? – Tyler 2010-08-30 15:29:08