Sign in to follow this  
ballack

Direct3D device failed error

Recommended Posts

hi i have created a skeleton Direct3D app. but when i run the app i get the error as Direct3D device failed to initialize or something. and its showing the error at the LoadMesh() function. can any one help me out with this problem. can u tell me why do i get this error? thank you very much in advance.

Share this post


Link to post
Share on other sites
Hey,

It is likely that the value of device is NULL. Dereferencing a null pointer is going to throw an exception.

I suggest going back to the CreateDevice() method, checking its return value and also watching what debug information is spewed at you by Direct3D.

Hope that helps bud,

ace

Share this post


Link to post
Share on other sites
It's very important to check the exceptions and error codes that direct3d throws at you.
something like creating a device should definitely be checked if it failed or not.
e.g.

if(FAILER(pDirect3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window->hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &pDevice))
return false;


or you could go even further and check the result of the error code and then see why the device failed on creation.

PS: this goes for any other method that you call in directx that returns a HRESULT.
I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Quote:
Original post by gmax136
hımmm.did you try
if(FAILED(pDirect3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_SW, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &pDevice));


Sorry, that won't work. The D3DDEVTYPE_SW is a sure way to get a device failure if you arent using it properly.

EDIT: Maybe it's the data you put into your D3DPRESENT_PARAMETERS structure. If you don't put in sufficient or supported information into that structure, your device creation will surley fail.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this