# unable to create create D3D device

This topic is 4890 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

OK, check this code out:
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );

d3dpp.Windowed               = TRUE;
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.BackBufferWidth        = BBWidth;
d3dpp.BackBufferHeight       = BBHeight;
d3dpp.BackBufferFormat       = D3DFMT_X8R8G8B8;
d3dpp.PresentationInterval   = D3DPRESENT_INTERVAL_IMMEDIATE;

HRESULT hWnd2;

D3DDEVTYPE_HAL,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&g_pd3dDevice );

if(FAILED(hWnd2))
{
if(hWnd2 == D3DERR_INVALIDCALL)
MessageBox(NULL, "Parameters invalid","", MB_OK);

if(hWnd2 == D3DERR_NOTAVAILABLE)
MessageBox(NULL, "device does not support","", MB_OK);

if(hWnd2 == D3DERR_OUTOFVIDEOMEMORY)
MessageBox(NULL, "Out of Memory","", MB_OK);
}


On my Ati Radeon X800 system, it works perfectly. However, on my GeForce FX 5200 system (running Dual View if that matters), it returns the "device does not support" error message. I'm puzzled why one works but not the other... can someone enlighten me?

##### Share on other sites
If you have the debug runtime installed, the debug spew will tell you why it's failing. See the D3D debugging section in the Forum FAQ.

##### Share on other sites
Quote:
 Original post by DrunkenHyenaIf you have the debug runtime installed, the debug spew will tell you why it's failing. See the D3D debugging section in the Forum FAQ.

I'm not exactly sure what you mean by the "debug spew".

I added the DXTRACE_ERR_MSGBOX to my code like the article suggested, which told me the device was failing with a "D3DERR_NOTAVAILABLE" error. Which was nothing i didn't know already...

##### Share on other sites
Try setting EnableAutoDepthStencil to TRUE.

##### Share on other sites
He means the debug output that the debug dx runtime produces.

If you have the debug runtime installed, there should be an option to use that instead of the release runtime somewhere on your start menu. Switch to the debug runtime, restart, and then go to the control panel, open the DirectX properties dialog and whack the direct3d debug output settings up.

Now when you run the application it should vomit forth a whole load of debug output that should help you narrow it down.

##### Share on other sites
From the FAQ:

How do I debug a DirectX application?

More or less the same way as you debug anything else. However, there are some useful DirectX-specific things I should mention here. First, the DirectX debug runtime can be configured to print out debugging messages, which are often extremely useful. Through the DirectX Control Panel, you can set the level
of messages that you want (the highest level will tell you about anything and everything that DirectX does, while the lower levels will only tell you about particularly important events, like errors). To view the messages, you need a debug viewer; Microsoft Visual Studio has one built in (the "Debug" pane), while people using other setups could use a utility like DebugView.

##### Share on other sites
Quote:
 Original post by DrunkenHyenaFrom the FAQ:How do I debug a DirectX application?More or less the same way as you debug anything else. However, there are some useful DirectX-specific things I should mention here. First, the DirectX debug runtime can be configured to print out debugging messages, which are often extremely useful. Through the DirectX Control Panel, you can set the levelof messages that you want (the highest level will tell you about anything and everything that DirectX does, while the lower levels will only tell you about particularly important events, like errors). To view the messages, you need a debug viewer; Microsoft Visual Studio has one built in (the "Debug" pane), while people using other setups could use a utility like DebugView.

Ok I understand. Currently there isn't anything DirectX related being spewed to the debug pane. So I guess i need to set it to in the "DirectX Control Panel". Is this something within Visual Studio (i am using v6)? I cant seem to find this control panel...

Thanks for your help so far BTW :)

##### Share on other sites
No, it should be an icon in the windows control panel, e.g Start->Settings->Control Panel.

##### Share on other sites
Quote:
 Original post by SandmanNo, it should be an icon in the windows control panel, e.g Start->Settings->Control Panel.

nothing there....

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633710
• Total Posts
3013482
×