Re: CreateDevice() returns D3DERR_INVALIDCALL





On Jan 18, 4:28 pm, "PaulH" <paul.h...@xxxxxxxxx> wrote:
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;
There's a few other things I should mention that might affect this as
well:
The DxViewer.exe utility crashes when I open it.
The DXErr.exe won't open at all.
I have a dual-monitor configuration and a GeForce FX5200 graphics card.
dxcpl.exe seems to work fine. I've tried using the debug version of
direct3d and I still get the same error.

Thanks,
-PaulH

.



Relevant Pages

  • Cello Speed Week Results
    ... Cello Speed Week!!!!!!! ... by bifurcating the rendering of the shape such that the varying rotation ... Note that this is a phat 900x900 window, ... OpenGL clipping. ...
    (comp.lang.lisp)
  • Re: R14sp3 and Mac OS X 10.4.2
    ... anything into the command window, ... >>> c) Graphics is really really slow. ... >> Graphics rendering times seem okay to me. ... >> Colorbars seem to export fine to PDF or EPS files, ...
    (comp.soft-sys.matlab)
  • Re: center/shrink to fit redux.
    ... for pathologically odd text or window size. ... the rendering is not as pretty, but is easy to use and accessible, and ... CSS has flaws, that's the bottom line... ... immediate problem. ...
    (alt.html)
  • Re: Do I have to redraw everything every frame / loading meshes
    ... Currently, each 3d window loads its own meshes, and as the static mesh is ... caching the result of rendering or simplifying the rendering. ... creating a secondary depth buffer and a secondary plain surface ... or substituting low-fidelity geometry for the ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Did you ever notice that it never happens...
    ... NEVER fails with the window in the Up position, ... wrap of fabric tape, all in the foot wells of the floor pan where ... there you would never expect to find such nasty stuff as salt water, ...
    (rec.crafts.metalworking)