unable to create create D3D device

Started by
7 comments, last by scitmon 18 years, 9 months ago
OK, check this code out:

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

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

HRESULT hWnd2;

hWnd2 = g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, 
			     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?
Advertisement
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.
Stay Casual,KenDrunken Hyena
Quote:Original post by DrunkenHyena
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.


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...
Try setting EnableAutoDepthStencil to TRUE.
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.
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.

Stay Casual,KenDrunken Hyena
Quote:Original post by DrunkenHyena
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.


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 :)
No, it should be an icon in the windows control panel, e.g Start->Settings->Control Panel.
Quote:Original post by Sandman
No, it should be an icon in the windows control panel, e.g Start->Settings->Control Panel.


nothing there....

This topic is closed to new replies.

Advertisement