Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > DirectX > Dx8 Automation Error


Reply
 
Thread Tools Display Modes
  #1  
Old 05-03-2001, 03:40 AM
Matt Nash
Guest
 
Posts: n/a
Default Dx8 Automation Error


I got this stuff from a tutorial on Dirextx 8, but I can't get it to work. I keep getting an automation error when creating the device.

Someone please help

Thanks, Matt

<font color=blue>Dim Dx As DirectX8
Dim D3D As Direct3D8
Dim D3DDevice As Direct3DDevice8
Dim bRunning As Boolean

Private Sub Form_Load()

Me.Show
bRunning = Initialise

Do While bRunning
Render
DoEvents
Loop

Set D3DDevice = Nothing
Set D3D = Nothing
Set Dx = Nothing

Unload Me
End

End Sub

Public Function Initialise() As Boolean

Dim Dispmode As D3DDISPLAYMODE
Dim D3DWindow As D3DPRESENT_PARAMETERS

'On Error GoTo ErrHandler

Set Dx = New DirectX8
Set D3D = Dx.Direct3DCreate

D3D.GetAdapterDisplayMode D3DADAPTER_DEFAULT, Dispmode
D3DWindow.Windowed = 1
D3DWindow.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
D3DWindow.BackBufferFormat = Dispmode.Format

Set D3DDevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, frmMain.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)

Initialise = True
Exit Function

'ErrHandler:
'Initialise = False

End Function

Public Sub Render()

D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, &HCCCCFF, 1#, 0

D3DDevice.BeginScene
'Render stuff here
D3DDevice.EndScene

D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0

End Sub
</font color=blue>



Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->