Directx 8 error in vb.net

Moonripper

New member
Joined
Feb 6, 2005
Messages
1
Programming Experience
3-5
I am working on converting a game engine from vb6 and the code below errors in vb.net. can any one help?

errors with:
An unhandled exception of type 'System.InvalidCastException' occurred in WindowsApplication5.exe

Additional information: QueryInterface for interface DxVBLibA.D3DXSprite failed.


Dim DX As DxVBLibA.DirectX8 = Nothing
Dim d3d As DxVBLibA.Direct3D8 = Nothing
Dim d3dDevice As DxVBLibA.Direct3DDevice8 = Nothing
Dim d3dx As DxVBLibA.D3DX8 = Nothing
Dim d3dpp As DxVBLibA.D3DPRESENT_PARAMETERS = Nothing
Dim d3dCaps As DxVBLibA.D3DCAPS8 = Nothing
Dim d3ddm As DxVBLibA.D3DDISPLAYMODE = Nothing
Dim d3dSprite As DxVBLibA.D3DXSprite = Nothing
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DX = New DxVBLibA.DirectX8
d3d = DX.Direct3DCreate
d3dx = New DxVBLibA.D3DX8
Dim DeviceType As DxVBLibA.CONST_D3DDEVTYPE
DeviceType = DxVBLibA.CONST_D3DDEVTYPE.D3DDEVTYPE_HAL
d3d.GetDeviceCaps(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, DeviceType, d3dCaps)
d3d.GetAdapterDisplayMode(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, d3ddm)
With d3dpp
.SwapEffect = DxVBLibA.CONST_D3DSWAPEFFECT.D3DSWAPEFFECT_COPY_VSYNC
.BackBufferFormat = d3ddm.Format
.Windowed = True
End With
d3dDevice = d3d.CreateDevice(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, DeviceType, PictureBox1.Handle.ToInt32, DxVBLibA.CONST_D3DCREATEFLAGS.D3DCREATE_SOFTWARE_VERTEXPROCESSING, d3dpp)
d3dSprite = d3dx.CreateSprite(d3dDevice)
End Sub
 
Top Bottom