Archived

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

IDirect3DDevice8::CreateDevice problems

Recommended Posts

Hi, Just started with DirectX, and have been using Drunken Hyena''s tutorials. However, I''ve run into a fundemental problem, a problem creating the DX device. I''m using Dev C++ 4 with a ATi XPERT 99/00 (yup, I need to upgrade soon ) Here''s the initation of D3D:

iD3D=Direct3DCreate8(D3D_SDK_VERSION);

if (!iD3D) FatalError("Fatal error getting D3D instance");

if (FAILED(hr)) FatalError("Fatal error getting display mode");

ZeroMemory(&d3dpp,sizeof(&d3dpp));

d3dpp.hDeviceWindow=hWnd;
d3dpp.Windowed=true;
d3dpp.BackBufferFormat=displaymode.Format;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

D3DDEVTYPE_REF,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&iDD);

if (FAILED(hr))
{
FatalError("Error creating device");
return hr;
}

CreateDevice always fails, and I have tried a number of parameters. Any ideas?

Share on other sites
You aren't setting backbuffer width and height.
Also why don't you switch to HAL?

Also to use ZBuffering as you state in your D3DPRESENT_PARAMETERS instance, you must set the EnableAutoDepthStencil to TRUE too. The format isn't enough.

[edited by - aker_jus on May 3, 2003 3:48:38 PM]

Share on other sites
Do I still need to set the backbuffer width and height, even in windowed mode?

Yes.

Share on other sites
Nah, I don't think you need to set backbufferheight & width for windowed mode...

At least I didn't need that, but you will need to set the BackBuffer.Format to the Format the current displaysettings use.
(which is what you did...)

[edited by - bilsa on May 3, 2003 7:01:59 PM]

Share on other sites
I''ll see how setting the back buffer height and width goes.

Share on other sites
Nope, no luck. Is it a problem with my graphics card or something?

Share on other sites
Would creating it in fullscreen be any better?

Share on other sites
Okay I dont think this is the problem but if you are using a ZBuffer then you need:

d3dpp.EnableAutoDepthStencil = TRUE;

i think.

Other than that it looks good, try stepping through the debugger to that line and check the values, im guessing hWnd is NULL.

Hope this helps
Cya.
Ash

Share on other sites
Yup. Solved it now :D

• Forum Statistics

• Total Topics
628394
• Total Posts
2982427

• 10
• 9
• 19
• 24
• 9