CreateDevice question

Started by
1 comment, last by lwinkenb 20 years, 4 months ago
My code to initialize D3D has always worked fine on my home computer, but now I'm at my parents house and I'm running into some trouble getting the CreateDevice function to work. The error msg I get from DXGetErrorDescription9 is "Not Available". Here is the code:

D3DPRESENT_PARAMETERS d3dpp;
	memset(&d3dpp, 0, sizeof(d3dpp));
	if(!m_windowed)
	{
		// Set up the parameters for full screen

		d3dpp.Windowed					= FALSE;
		d3dpp.EnableAutoDepthStencil	= TRUE;
		d3dpp.AutoDepthStencilFormat	= D3DFMT_UNKNOWN;
		d3dpp.BackBufferWidth			= 640;
		d3dpp.BackBufferHeight			= 480;
		d3dpp.BackBufferFormat			= D3DFMT_UNKNOWN;
		d3dpp.SwapEffect				= D3DSWAPEFFECT_DISCARD;

		ShowCursor(false);
	}
	else
	{
		// Set up the parameters for windowed mode

		ZeroMemory(&d3ddm, sizeof(d3ddm));
		if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
		{
			return FALSE;
		}
		d3dpp.Windowed					= TRUE;
		d3dpp.BackBufferFormat			= D3DFMT_UNKNOWN;
		d3dpp.SwapEffect				= D3DSWAPEFFECT_DISCARD;
		d3dpp.EnableAutoDepthStencil	= FALSE;
		d3dpp.AutoDepthStencilFormat	= D3DFMT_UNKNOWN;
	}
	
	HRESULT er = m_pD3D->CreateDevice(	D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, m_hWnd,
										D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &m_pd3dDevice ) ;
Now I know the graphics card on this computer is pretty bad (It's an Intel 82810 Graphics Controller), but it still plays games like Diablo. Ive tried passing both the D3DDEVTYPE_REF parameter and D3DDEVTYPE_HAL parameter to CreateDevice, but it doesn't work either way. How can I get this running on this computer? EDIT: formatting [edited by - lwinkenb on December 14, 2003 5:08:13 AM]
Advertisement
Your code is a bit strange.
In fullscreen mode you use a Zbuffer, but in windowed mode you are running with Zbuffering turned off ? (d3dpp.EnableAutoDepthStencil = TRUE/FALSE)
I think you need to set it to true in windowed mode as well.

If you run windowed you can specify D3DFMT_UNKNOWN for backbuffer, but I think that in fullscreen mode you mut specify a color format, eg. D3DFMT_R5G6B5.
Also try setting Autodepthstencilformat to D3DFMT_D16 instead of unknown if you use a Zbuffer, it should be supported on every card.
If the card has no DX7+ drivers, it will give you the "Not available" error under DX9.
You can check for that with DxDiag, look for the (DDI level) under the "Display" tab. If it''s less than 7, then the card won''t run DX9 apps.

Muhammad Haggag

This topic is closed to new replies.

Advertisement