CreateDevice() returns D3DERR_INVALIDCALL
- From: "PaulH" <paul.heil@xxxxxxxxx>
- Date: 18 Jan 2007 14:28:02 -0800
I have a dialog app where I'd like to have a control that is direct3d
rendered. So, when this control's window is created I call an
CreateDevice() as below. But, it always fails with the error code
D3DERR_INVALIDCALL (0x8876086c).
I've essentially stolen this function from the Directx9 (December 2006)
SDK vertex tutorial sample. The SDK tutorial works perfectly. Why does
the same code fail in my program? I assume it's because the whole
dialog window isn't Direct3D, just one control. Is there something
special I need to do to make this work?
(I have also tried using D3DDEVTYPE_REF as suggested to people
reporting a similar problem in other forums, but that doesn't seem to
make any difference.)
Thanks,
PaulH
HRESULT InitD3D()
{
// Create the D3D object.
if( NULL == ( m_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
{
ATLTRACE( _T( "Failed to Init Direct3D\n" ) );
return E_FAIL;
}
// Set up the structure used to create the D3DDevice
D3DPRESENT_PARAMETERS d3dpp = { 0 };
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
// Create the D3DDevice
HRESULT hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&m_pd3dDevice );
if( FAILED( hr ) )
{
ATLTRACE( _T( "Failed to create Direct3D device. %#08x\n"
), hr );
return E_FAIL;
}
// Device state would normally be set here
return S_OK;
};
/// Used to create the D3DDevice
LPDIRECT3D9 m_pD3D;
/// Our rendering device
LPDIRECT3DDEVICE9 m_pd3dDevice;
.
- Follow-Ups:
- Re: CreateDevice() returns D3DERR_INVALIDCALL
- From: Richard [Microsoft Direct3D MVP]
- Re: CreateDevice() returns D3DERR_INVALIDCALL
- From: PaulH
- Re: CreateDevice() returns D3DERR_INVALIDCALL
- Prev by Date: Re: copy texture to another texture
- Next by Date: Re: CreateDevice() returns D3DERR_INVALIDCALL
- Previous by thread: Re: OpenGL1.2
- Next by thread: Re: CreateDevice() returns D3DERR_INVALIDCALL
- Index(es):
Relevant Pages
|