|
-
May 18th, 2002, 02:25 PM
#1
Thread Starter
Hyperactive Member
Direct3D init --> using DirectX 8.1
VB Code:
'// 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 code should work with DirectX 8.1 but ther's still a little
problem left:
D3DADAPTER_DEFAULT is not found anywhere in the DirectX libary.
Mybe this code was written for 8.0?
What can I use instead of D3DADAPTER_DEFAULT?
Any ideas?
thx!
-
May 18th, 2002, 08:32 PM
#2
Frenzied Member
Sanity is a full time job
Puh das war harter Stoff!
-
May 19th, 2002, 12:07 AM
#3
Did you add the DX8.1 type library to your references list? The constant is the same for 8.0 and 8.1.
Z.
-
May 19th, 2002, 06:02 AM
#4
Thread Starter
Hyperactive Member
I found the problem:
CONST_D3DCONST.D3DADAPTER_DEFAULT
is the variable
thx!
-
May 19th, 2002, 08:44 AM
#5
Frenzied Member
so what is it? not 1 or 0?
Sanity is a full time job
Puh das war harter Stoff!
-
May 19th, 2002, 08:45 AM
#6
Thread Starter
Hyperactive Member
don't know...
I guess it's 0 because the reference says 0 is for 'unknown adapter'
-
May 19th, 2002, 08:48 AM
#7
Thread Starter
Hyperactive Member
but now there's a nice new problem:
after direct3d init, the system crashes if I run
the app in full-screen mode.
when I run it windowed, all works fine.
I guess that will also take some time to figure out.
-
May 19th, 2002, 08:30 PM
#8
Misan, D3DADAPTER_DEFAULT == 0.
vbzero, Check your back buffer format. It is probably unsupported. Check in the DirectX Caps Viewer (it was installed where your SDK was installed, and its in the start menu). Check what back buffer formats your card supports, and use one of them. Also make sure you arent switching into a mode your monitor doesnt support.
I would NOT advise working on your project and testing it in fullscreen. You may end up having to restart your computer A LOT. Just a word of advice.
Z.
-
May 20th, 2002, 06:33 AM
#9
Thread Starter
Hyperactive Member
You're right!
The problem is the backbuffer format. But isn't there a
possibility to let the program find out which backbuffer
is correct?
How did they do that in commercial games?
My backbuffer:
VB Code:
// Setting the new display format
//
D3DDispMode.Format = CONST_D3DFORMAT.D3DFMT_X8R8G8B8;
D3DDispMode.Height = 480;
D3DDispMode.Width = 640;
//
// Setting the new window format
//
D3DWindow.Windowed = 0;
D3DWindow.SwapEffect = CONST_D3DSWAPEFFECT.D3DSWAPEFFECT_FLIP;
D3DWindow.BackBufferCount = 1;
D3DWindow.BackBufferFormat = D3DDispMode.Format;
D3DWindow.BackBufferHeight = 480;
D3DWindow.BackBufferWidth = 640;
D3DWindow.hDeviceWindow = Me.hWnd;
-
May 20th, 2002, 08:15 AM
#10
When you Query the adapter, you are querying the CURRENT settings. You need some extra code to do Caps Checks to find out which cards support which back buffer formats.
Z.
-
May 20th, 2002, 08:17 AM
#11
Thread Starter
Hyperactive Member
I just found a tutorial to that...
thx very much!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|