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