iD3D=Direct3DCreate8(D3D_SDK_VERSION);
if (!iD3D) FatalError("Fatal error getting D3D instance");
hr=iD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&displaymode);
if (FAILED(hr)) FatalError("Fatal error getting display mode");
ZeroMemory(&d3dpp,sizeof(&d3dpp));
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow=hWnd;
d3dpp.Windowed=true;
d3dpp.BackBufferFormat=displaymode.Format;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
hr=iD3D->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_REF,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&iDD);
if (FAILED(hr))
{
FatalError("Error creating device");
return hr;
}
IDirect3DDevice8::CreateDevice problems
Hi,
Just started with DirectX, and have been using Drunken Hyena''s tutorials. However, I''ve run into a fundemental problem, a problem creating the DX device. I''m using Dev C++ 4 with a ATi XPERT 99/00 (yup, I need to upgrade soon )
Here''s the initation of D3D:
CreateDevice always fails, and I have tried a number of parameters.
Any ideas?
You aren't setting backbuffer width and height.
Also why don't you switch to HAL?
Also to use ZBuffering as you state in your D3DPRESENT_PARAMETERS instance, you must set the EnableAutoDepthStencil to TRUE too. The format isn't enough.
[edited by - aker_jus on May 3, 2003 3:48:38 PM]
Also why don't you switch to HAL?
Also to use ZBuffering as you state in your D3DPRESENT_PARAMETERS instance, you must set the EnableAutoDepthStencil to TRUE too. The format isn't enough.
[edited by - aker_jus on May 3, 2003 3:48:38 PM]
Nah, I don't think you need to set backbufferheight & width for windowed mode...
At least I didn't need that, but you will need to set the BackBuffer.Format to the Format the current displaysettings use.
(which is what you did...)
[edited by - bilsa on May 3, 2003 7:01:59 PM]
At least I didn't need that, but you will need to set the BackBuffer.Format to the Format the current displaysettings use.
(which is what you did...)
[edited by - bilsa on May 3, 2003 7:01:59 PM]
Okay I dont think this is the problem but if you are using a ZBuffer then you need:
d3dpp.EnableAutoDepthStencil = TRUE;
i think.
Other than that it looks good, try stepping through the debugger to that line and check the values, im guessing hWnd is NULL.
Hope this helps
Cya.
Ash
d3dpp.EnableAutoDepthStencil = TRUE;
i think.
Other than that it looks good, try stepping through the debugger to that line and check the values, im guessing hWnd is NULL.
Hope this helps
Cya.
Ash
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement