Hu Flung Dung
May 21st, 2002, 04:12 PM
The first graphics tutorial for DirectX8 on www.directx4vb.com was poorly written and assumes too much knowledge.
Here's the initialize procedure in that tutorial:
'// Initialise : This procedure kick starts the whole process.
'// It'll return true for success, false if there was an error.
Public Function Initialise() as Boolean
On Error Goto ErrHandler:
Dim DispMode as D3DDISPLAYMODE '//Describes our Display Mode
Dim D3DWindow as D3DPRESENT_PARAMETERS '//Describes our Viewport
Set Dx = New DirectX8 '//Create our Master Object
Set D3D = Dx.Direct3DCreate() '//Make our Master Object create the Direct3D Interface
D3D.GetAdapterDisplayMode D3DADAPTER_DEFAULT, DispMode '//Retrieve the current display Mode
D3DWindow.Windowed = 1 '//Tell it we're using Windowed Mode
D3DWindow.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC '//We'll refresh when the monitor does
D3DWindow.BackBufferFormat = DispMode.Format '//We'll use the format we just retrieved...
'//This line will be explained in detail in a minute...
Set D3DDevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, FrmMain.Hwnd, _
_ D3DCREATE_SOFTWARE_VERTEXPROCESSING, _
_ D3DWindow)
Initialise = True '//We succeeded
Exit Function
ErrHandler:
'//We failed; for now we wont worry about why.
Initialise = False
End Function
This tutorial assumes knowledge of the following words:
viewport, swapeffect, backbuffer, rasterizer.
I have never heard these words before. What do they mean? The tutorial should define them.
Also, this tutorial passes 'frmMain.hWnd' to the CreateDevice procedure without ever telling you to change the name of Form1 to frmMain.
Heres the 'Render' procedure:
Public Sub Render()
'//1. We need to clear the render device before we can draw anything
' This must always happen before you start rendering stuff...
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, &HCCCCFF, 1#, 0
'the hexidecimal value in the middle is the same as when you're using colours in HTML - if you're familiar
'with that.
'//2. Next we would render everything. This lesson doesn't do this, but if it did it'd look something
' like this:
D3DDevice.BeginScene
'All rendering calls go between these two lines
D3DDevice.EndScene
'//3. Update the frame to the screen...
' This is the same as the Primary.Flip method as used in DirectX 7
' These values below should work for almost all cases...
D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0
End Sub
First of all, it shouldn't assume knowledge of what the hex numbers do. It took me a while to figure out what it means.
This tutorial never described what 'D3DClear_Target' does, or what the '1#' does.
This tutorial never even described what the 'Present' procedure does.
In the 'FormLoad' procedure, there's an uncommented line, 'On Error Resume Next', but it was still colored green on the tutorial. This proves that this tutorial was never revised.
After all of this, the tutorial then says that you should know what everything means before moving on to other tutorials.
Are there any good online DirectX8 tutorials for beginners? I dont know why you guys always recommend this one.
Here's the initialize procedure in that tutorial:
'// Initialise : This procedure kick starts the whole process.
'// It'll return true for success, false if there was an error.
Public Function Initialise() as Boolean
On Error Goto ErrHandler:
Dim DispMode as D3DDISPLAYMODE '//Describes our Display Mode
Dim D3DWindow as D3DPRESENT_PARAMETERS '//Describes our Viewport
Set Dx = New DirectX8 '//Create our Master Object
Set D3D = Dx.Direct3DCreate() '//Make our Master Object create the Direct3D Interface
D3D.GetAdapterDisplayMode D3DADAPTER_DEFAULT, DispMode '//Retrieve the current display Mode
D3DWindow.Windowed = 1 '//Tell it we're using Windowed Mode
D3DWindow.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC '//We'll refresh when the monitor does
D3DWindow.BackBufferFormat = DispMode.Format '//We'll use the format we just retrieved...
'//This line will be explained in detail in a minute...
Set D3DDevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, FrmMain.Hwnd, _
_ D3DCREATE_SOFTWARE_VERTEXPROCESSING, _
_ D3DWindow)
Initialise = True '//We succeeded
Exit Function
ErrHandler:
'//We failed; for now we wont worry about why.
Initialise = False
End Function
This tutorial assumes knowledge of the following words:
viewport, swapeffect, backbuffer, rasterizer.
I have never heard these words before. What do they mean? The tutorial should define them.
Also, this tutorial passes 'frmMain.hWnd' to the CreateDevice procedure without ever telling you to change the name of Form1 to frmMain.
Heres the 'Render' procedure:
Public Sub Render()
'//1. We need to clear the render device before we can draw anything
' This must always happen before you start rendering stuff...
D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, &HCCCCFF, 1#, 0
'the hexidecimal value in the middle is the same as when you're using colours in HTML - if you're familiar
'with that.
'//2. Next we would render everything. This lesson doesn't do this, but if it did it'd look something
' like this:
D3DDevice.BeginScene
'All rendering calls go between these two lines
D3DDevice.EndScene
'//3. Update the frame to the screen...
' This is the same as the Primary.Flip method as used in DirectX 7
' These values below should work for almost all cases...
D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0
End Sub
First of all, it shouldn't assume knowledge of what the hex numbers do. It took me a while to figure out what it means.
This tutorial never described what 'D3DClear_Target' does, or what the '1#' does.
This tutorial never even described what the 'Present' procedure does.
In the 'FormLoad' procedure, there's an uncommented line, 'On Error Resume Next', but it was still colored green on the tutorial. This proves that this tutorial was never revised.
After all of this, the tutorial then says that you should know what everything means before moving on to other tutorials.
Are there any good online DirectX8 tutorials for beginners? I dont know why you guys always recommend this one.