I'm trying to create my device for Direct3D, but I keep getting D3DERR_INVALIDCALL. This is my call to CreateDevice():
long dev_result = d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,m_window,D3DCREATE_MIXED_VERTEXPROCESSING,
&d3dpp,&m_device);
As far as I can see, the only things that could be wrong are the window(m_window), the presentation parameters (d3dpp), the device (m_device), or some thing else that I'm unaware of that could be causing the problem.
Here's the declaration of m_device:
IDirect3DDevice9* m_device;
Here are my presentation parameters:
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS));
d3dpp.BackBufferWidth = g_deviceEnumeration->GetSelectedDisplayMode()->Width;
d3dpp.BackBufferHeight = g_deviceEnumeration->GetSelectedDisplayMode()->Height;
d3dpp.BackBufferFormat = g_deviceEnumeration->GetSelectedDisplayMode()->Format;
d3dpp.BackBufferCount = m_setup->totalBackBuffers;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = m_window;
d3dpp.Windowed = g_deviceEnumeration->IsWindowed();
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.FullScreen_RefreshRateInHz = g_deviceEnumeration->GetSelectedDisplayMode()->RefreshRate;
if(g_deviceEnumeration->IsVSynced() == true)
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
else
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
And here's the creation of the window:
if((m_window = CreateWindow("WindowClass",m_setup->name,g_deviceEnumeration->IsWindowed() ? WS_OVERLAPPED : WS_POPUP,0,0,800,600,NULL,NULL,m_setup->instance,NULL)) == NULL)
{
MessageBox(NULL,"Error creating the window","CreateWindow()",MB_OK | MB_ICONERROR);
return;
}Can anyone help me with this? I've had this up in another forum but no one was able to help.
Any and all help is greatly appreciated.
Viri qui habent nullum, timent nullum.
Men who have nothing, fear nothing.