Archived

This topic is now archived and is closed to further replies.

Oddball

Program crashes immediately

Recommended Posts

I created a simple DirectX 8 program which runs fine on my computer, as well as on 2 other computers I tested it on. However, I sent the program to my friend, and it crashes immediately when he runs it. He has DirectX 8 installed, and has the following system specs: ATI Rage graphics card, AMD K6 processor at 350MHz, 64MB RAM I''ve determined that the error is occuring when CreateDevice is called, as shown below: ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed=TRUE; d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat=d3ddm.Format; d3dpp.EnableAutoDepthStencil=TRUE; d3dpp.AutoDepthStencilFormat=D3DFMT_D16; d3dpp.FullScreen_RefreshRateInHz=0; hr=d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice ); The CreateDevice call fails, which causes the program to crash. Any suggestions on how I can fix up the code to make it compatible? Thanks.

Share this post


Link to post
Share on other sites
I had him try all different monitor resolutions and color depth settings. Besides, I don''t see why a machine like his wouldn''t support a DirectX device. Are there any other depth settings I could try that might work? Or is there a way to auto-detect his video card''s capabilities or something? Thanks.

Share this post


Link to post
Share on other sites
Check what the return code is.

My first guess is its D3DERR_NOTAVAILABLE...

...The reason ? - To use D3D8 interfaces, the graphics card needs a minimum of DirectX 6 drivers, if up to date drivers aren''t found, D3D ignores the card (it would be too much work and extra bloat of D3D to scale all the way back to support stuff like execute buffers).


My second guess is that this is a windowed mode application and d3ddm.Format is the format of the desktop, and the desktop is in 24bit mode...

...Why would this fail ? - Most cards are unable to render 3D in 24bit per pixel mode (2D isn''t a problem), even when they can do 16 and 32. In fact, Matrox cards are about the only ones capable of doing 3D in 24bit. The best thing to do to protect against this is to check before you create the device and issue a message to the user to change mode if they want to run the app (maybe give the option to change it automatically for them).

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites