Direct3D 9: CreateDevice( ) Failing

Apr 21, 2011 at 9:08pm
closed account (zb0S216C)
As stated in the title, CreateDevice( ) continues to fail when called. My codes is lengthy so it won't be practical to post it here. However, I can post the call to CreateDevice( ):
1
2
3
4
5
6
7
LPDIRECT3D9 itrf(0);
LPDIREC3DDEVICE9 device(0);
D3DPRESENT_PARAMETERS params;

// Initialization of params and itrf here... 

itrf->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &params, &device);

I can't give many details as I'm receiving no errors or warnings. Any additional code can be posted if required.

Any help is appreciated :)
Apr 21, 2011 at 9:12pm
msdn wrote:
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_DEVICELOST, D3DERR_INVALIDCALL, D3DERR_NOTAVAILABLE, D3DERR_OUTOFVIDEOMEMORY.
Which is it?
Also, post params.
Apr 21, 2011 at 9:16pm
closed account (zb0S216C)
It returns D3DERR_INVALIDCALL for some reason. As for params, here they are:
1
2
3
4
5
6
7
params.hDeviceWindow = hwnd;
params.Windowed = true;
params.BackBufferCount = 1;
params.BackBufferFormat = D3DFMT_X8B8G8R8;
params.BackBufferWidth = 500;
params.BackBufferHeight = 500;
params.SwapEffect = D3DSWAPEFFECT_DISCARD;
Apr 21, 2011 at 9:24pm
Don't see anything wrong here.. Is hwnd OK? Did you fill the rest of params with 0s ?
Apr 21, 2011 at 9:29pm
closed account (zb0S216C)
I did initialize params with: ZeroMemory(&params, sizeof(D3DPRESENT_PARAMETERS)); I don't know if it'll help but here's the initialization of hwnd:
 
hwnd = CreateWindowEx(0, szClassName, "Caption", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 500, HWND_DESKTOP, NULL, hThisInstance, NULL );
Last edited on Apr 21, 2011 at 9:30pm
Topic archived. No new replies allowed.