Fallo de Directx 8 debido a una excepción

programación


Tengo un problema en un proyecto; quiero crear una imagen 3D usando DirectX 8 pero no puedo crear la imagen porque arroja una excepción:

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

Mi código:

Lo que he probado:

<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

Solución 1

En primer lugar, deja de usar On Error – usa el más moderno Try ... Catch en cambio.

Luego mira la definición de la función:
IDirect3D9::CreateDevice (d3d9.h) – Aplicaciones Win32 | Microsoft aprende[^]

O el tutorial de MS:
IDirect3D9::CreateDevice (d3d9.h) – Aplicaciones Win32 | Microsoft aprende[^]

Requiere 6 parámetros y usted proporciona solo 4…

コメント

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