Lỗi Directx 8 do ngoại lệ

lập trình


Tôi đang gặp sự cố với một dự án; Tôi muốn tạo hình ảnh 3D bằng directX 8 nhưng tôi không thể tạo hình ảnh vì nó đưa ra một ngoại lệ:

<pre lang="text">argumentnullException the argument of D3D.createDevice 's last parameter was null.

Mã của tôi:

Những gì tôi đã thử:

<pre lang="VB">
Imports System
imports system.drawing
imports system.data
imports system.collections.generic
imports system.windows.forms
imports Microsoft.direct4XVB.directX8
public class cellular
inherits Forms
Dim Dx8 As DirectX8
Dim D3D As Direct3D8
Dim app As Object = createObject("app")
Dim Device As Direct3Ddevice8
Dim apprunning As Boolean
Public Function init() As boolean
 On Error goto  errHdl:
  Dim Dispmode As D3Ddisplaymode,_
  Dwindow As D3Dpresent_parameters 
  Dx8=new DirectX8()
  D3D = Dx8.Direct3Dcreate()
  'the rest of the code isn't important reply 1209 to view it
  'the code where the problem Revolves 
  D3Ddevice = D3D.createDevice(D3Dadapter_default,D3Dedevtype_hal,D3Dcreate_software_vertexprocessing,D3Dwindow)
  init()=true
  Exit Function
  errhdl:
    init()=false
 End Function
End Class

Giải pháp 1

Trước hết, hãy ngừng sử dụng On Error – sử dụng hiện đại hơn Try ... Catch thay vì.

Sau đó nhìn vào định nghĩa của hàm:
IDirect3D9::CreateDevice (d3d9.h) – Ứng dụng Win32 | Microsoft Tìm hiểu[^]

Hoặc hướng dẫn MS:
IDirect3D9::CreateDevice (d3d9.h) – Ứng dụng Win32 | Microsoft Tìm hiểu[^]

Nó yêu cầu 6 tham số và bạn chỉ cung cấp 4 …

コメント

タイトルとURLをコピーしました