|
-
Sep 18th, 2002, 02:41 AM
#1
Thread Starter
Evil Genius
Direct3D Engine Initialising
I've finished the sounds & hardware finding tutorials fo DirectX (8.1), now I'm trying my hand at the graphics side (which I left 'till last on purpose)! 
I've tried "lesson 1" of the graphics tutorials on directx4vb.com, & the first routine (which I need for more or less everything I do in DX) doesn't work!!! I've tried this on 2 pc's now & can't see why this screws up. Any help'll be majorly appriciated! Cheers!
VB Code:
Public Function Initialise() As Boolean
Dim DispMode As D3DDISPLAYMODE
Dim D3DWindow As D3DPRESENT_PARAMETERS
Set Dx = New DirectX8
Set D3D = Dx.Direct3DCreate()
' Windowed Mode
D3D.GetAdapterDisplayMode CONST_D3DCONST.D3DADAPTER_DEFAULT, DispMode
With D3DWindow
.Windowed = 1
.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
.BackBufferFormat = DispMode.Format
End With
Set D3DDevice = D3D.CreateDevice(0, D3DDEVTYPE_REF, frmMain.hWnd, _
D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)
End Function
-
Sep 18th, 2002, 03:39 AM
#2
Frenzied Member
Perhaps ypu are missing this:
Code:
D3DPresentParams.hDeviceWindow = hWnd
Also, REF devices are too slow to be used for ANYTHING except driver testing. Use a HAL device.
Z.
-
Sep 18th, 2002, 03:48 AM
#3
Thread Starter
Evil Genius
Weird, thanks Zaei, I got it working on one pc, but the one I'm on at the moment refuses to take it, even though it supports HAL & the DX Dialog tests for Direct3D work in the windows control panel. 
Would there be any reason this pc won't take it?
Cheers.
-
Sep 18th, 2002, 06:20 AM
#4
Frenzied Member
Check device formats. If you run in windowed mode, and your back buffer format does not match the current screen resolution, it will NOT work. If you are in fullscreen, you need to make sure that the format you want is supported. Use the DX Caps Viewer that comes with the SDK to test.
Z.
-
Sep 19th, 2002, 08:58 AM
#5
Thread Starter
Evil Genius
I just wanna put a quick note up here, firstly so I don't forget it secondly for anyone else trying those tutorials with the same problem.
Both the fullscreen and windowed versions of the code were failing on the "format" parameter specified. The ones in the tutorial didn't work on all the computers I tried it on & I ended up changing these lines:
VB Code:
WindowedModeVariable.BackBufferFormat = DispMode.Format
FullScreenModeVariable.Format = D3DFMT_X8R8G8B8
to another of the CONST_D3DFORMAT constant values. (In the end, the D3DFMT_R5G6B5 value worked for me).
Ta!
-
Sep 23rd, 2002, 06:29 PM
#6
Fanatic Member
But isnt that something unique for each and every monitor/video card? You will have to use .getcaps function to get the formats. (or something similar) look at the help file that comes with dx sdk
-
Sep 23rd, 2002, 07:15 PM
#7
Frenzied Member
Yup, you have to enumerate for each card.
Z.
-
Sep 24th, 2002, 02:15 AM
#8
Thread Starter
Evil Genius
True, I just guessed that as this is a crappy video card maybe that was the lowest setting which'd work for most other cards.
Myself, I've written a function where I pass this value in to the initialisation after the enumeration bit.
-
Sep 24th, 2002, 04:43 PM
#9
Fanatic Member
The color settings will not work on all video cards.
Its not like the resolution which has a standard "lowest" which all computers can work with... no no..
The colorformats are not standard, and all different on different video cards. So just call a function to get you the color formats right after you initialize the primary surface. Because whatever color format the primary surface has, thats what all other surfaces will have anyways, right? Well im not so sure but most of my code for this worked fine so far...
Also if you are using C/C++ to do this... you might run into a problem... but i think vb takes care of all of this for you if you use the get/set pixel methods.
I mihgt be lost by now, but thats just my 2 cents right there.
Regards,
MoMad the NoMad
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
|