View Full Version: Cannot create render device

C++ Learning Community > Direct X > Cannot create render device


Title: Cannot create render device


ditto - November 5, 2003 03:40 AM (GMT)
The directx program from a book compiles and run but full screen is not shown.
I debugged it and found it fails to create a render device at this function:

r = pD3D->CreateDevice( D3DADAPTER_DEFAULT, 3DDEVTYPE_HAL,hWndTarget,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, ppDevice );

The ppDevice is NULL after the CreateDevice function returns.

Please help. Thanks.

TheHawgMaster - November 5, 2003 03:49 AM (GMT)
The device pointer must be 0 (NULL) when you pass it to the function. Are you doing this?

With D3D9, your code should look something like this:
CODE
IDirect3D9* Direct3D = Direct3DCreate9(D3D_SDK_VERSION);

D3DPRESENT_PARAMETERS d3dpp = {
640, 480, D3DFMT_R5G6B5, 1, D3DMULTISAMPLE_NONE,
0, D3DSWAPEFFECT_FLIP, Window, FALSE, FALSE,
(D3DFORMAT)0, 0, D3DPRESENT_RATE_DEFAULT, D3DPRESENT_INTERVAL_DEFAULT };
IDirect3DDevice9* D3DDevice = 0;
Direct3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
       D3DCREATE_HARDWARE_VERTEXPROCESSING,
       &d3dpp, &D3DDevice);




* Hosted for free by InvisionFree