Epo
06-29-2002, 01:50 PM
Dim objDX As DirectX8
Dim objDG As Direct3D8
Dim devDG As Direct3DDevice8
Dim DGInited As Boolean
Dim ProgramExiting As Boolean
Private Sub Form_Load()
Me.Show
Me.Caption = "Create Device: Initializing"
Set objDX = New DirectX8
DGInited = D3DInit()
If DGInited = False Then MsgBox ("Critical Failure Initializing DirectGraphics")
Me.Caption = "Create Device"
Do
Call devDG.Clear(0, ByVal 0, D3DCLEAR_TARGET, &HFF000080, 1#, 0)
devDG.BeginScene
devDG.EndScene
Call devDG.Present(ByVal 0, ByVal 0, 0, ByVal 0)
DoEvents
Loop Until ProgramExiting = True
End
End Sub
Function D3DInit() As Boolean
Dim UDTCurrentMode As D3DDISPLAYMODE
Dim UDTPParam As D3DPRESENT_PARAMETERS
On Error GoTo ErrorCheck
Set objDG = objDX.Direct3DCreate
Call objDG.GetAdapterDisplayMode(D3DADAPTER_DEFAULT, UDTCurrentMode)
With UDTPParam
.Windowed = 1
.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
.BackBufferFormat = UDTCurrentMode.Format
End With
Set devDG = objDG.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, UDTPParam) '**********
If devDG Is Nothing Then GoTo ErrorCheck
D3DInit = True
Exit Function
ErrorCheck:
D3DInit = False
End Function
Private Sub Form_Unload(Cancel As Integer)
Set devDG = Nothing
Set objDG = Nothing
ProgramExiting = True
End Sub
I really hate posting my code and asking other people to find the problem, but I'm all out of ideas....The error occurs on the line with all the stars...something craps out in there and it ends up going to the error thingy....does anyone see something wrong? (By the way, I got just about all of this from a tutorial...good tutorial eh?) :)
Dim objDG As Direct3D8
Dim devDG As Direct3DDevice8
Dim DGInited As Boolean
Dim ProgramExiting As Boolean
Private Sub Form_Load()
Me.Show
Me.Caption = "Create Device: Initializing"
Set objDX = New DirectX8
DGInited = D3DInit()
If DGInited = False Then MsgBox ("Critical Failure Initializing DirectGraphics")
Me.Caption = "Create Device"
Do
Call devDG.Clear(0, ByVal 0, D3DCLEAR_TARGET, &HFF000080, 1#, 0)
devDG.BeginScene
devDG.EndScene
Call devDG.Present(ByVal 0, ByVal 0, 0, ByVal 0)
DoEvents
Loop Until ProgramExiting = True
End
End Sub
Function D3DInit() As Boolean
Dim UDTCurrentMode As D3DDISPLAYMODE
Dim UDTPParam As D3DPRESENT_PARAMETERS
On Error GoTo ErrorCheck
Set objDG = objDX.Direct3DCreate
Call objDG.GetAdapterDisplayMode(D3DADAPTER_DEFAULT, UDTCurrentMode)
With UDTPParam
.Windowed = 1
.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
.BackBufferFormat = UDTCurrentMode.Format
End With
Set devDG = objDG.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, UDTPParam) '**********
If devDG Is Nothing Then GoTo ErrorCheck
D3DInit = True
Exit Function
ErrorCheck:
D3DInit = False
End Function
Private Sub Form_Unload(Cancel As Integer)
Set devDG = Nothing
Set objDG = Nothing
ProgramExiting = True
End Sub
I really hate posting my code and asking other people to find the problem, but I'm all out of ideas....The error occurs on the line with all the stars...something craps out in there and it ends up going to the error thingy....does anyone see something wrong? (By the way, I got just about all of this from a tutorial...good tutorial eh?) :)