Can YOU spot the problem?

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?) :)

Squirm
06-29-2002, 04:44 PM
I dont see anywhere that you're setting the value of hWnd, or even where it is declared. Why don't you Debug.Print the error to at least give some clue?

:-\

Epo
06-29-2002, 08:50 PM
I decided to move to fullscreen mode and that fixed the problem :) Probably not the best solution but hey :) ..yeah hWnd...i changed it to frmMain.hWnd (even though the tutorial didn't say to) and it still happened. Fullscreen mode works fine now so I'm not really worrying about this :)

Thanks for the advice though :)

denmeister
07-02-2002, 02:02 PM
I've run into this problem a couple times. One time I solved. It was that the screen was set to a non-supported window mode. I think it was set to 24-bit color or something like that. But if it works in full-screen but not window mode, try changine your resolution, and for added insurance you could enumerate all your display modes and see if the one you currently have is supported in windowed mode. If it isn't in you list of enumerated modes, then you can display an appropriate error message or switch to full screen, or even give the user a choice. Just a thought, and it might not be your problem but it's as good a guess as I can manage.

Epo
07-02-2002, 04:22 PM
Alrighty :) Thanks for the reply. I may be planning to do enumeration eventually but for now I'm way too lazy and there are other things I'd rather be doing :) For now it's getting the rough gameplay done (probably once I get to the ending stages I'll look in to some enumeration) :)


Thanks again

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum