Skip to main content
GameDev.net gamedev.net
🔒 Locked

Direct3DCreate9 fails!

Started by Kekko Jan 14, 2005 at 7:44 AM 6 replies 7.5k views
Original Post
Kekko
Kekko
I'm working on a little editor for a game. It works just fine on my computer, but on another computer, Direct3DCreate9() fails. It didn't do that before, but no it does... We've tried updating to the latest DirectX, but it didn't work. Does anyone know what could possibly cause Direct3DCreate9 to fail?
PsychoDude
PsychoDude
Maybe you've got the same prob as I had and are using D3DDEVTYPE_RES instead of D3DDEVTYPE_HAL? That caused it for me to fail to whilst initializing it.
PumpkinPieman
PumpkinPieman
It could be anything, try setting asserts in the code so that when something fails you'll know exactly where it did fail so you can fix it.
Kekko
Kekko
The problem is I really don't know what to assert. I'm talking about the function:
IDirect3D9 *ptr = Direct3DCreate9(D3D_SDK_VERSION)

the pointer it returns is NULL. I have no idea where to even start debugging such a problem.
PumpkinPieman
PumpkinPieman
Quote:

The D3D_SDK_VERSION identifier is passed to this function in order to ensure that an application was built against the correct header files. This value is incremented whenever a header or other change would require applications to be rebuilt. If the version does not match, this function will fail.
Possibility? Check your headers.

Header d3d9.h
Import library d3d9.lib

#include <d3d9.h>#pragma comment(lib,"d3d9.lib")
DrunkenHyena
DrunkenHyena
Quote:
Original post by Kekko
The problem is I really don't know what to assert. I'm talking about the function:
IDirect3D9 *ptr = Direct3DCreate9(D3D_SDK_VERSION)

the pointer it returns is NULL. I have no idea where to even start debugging such a problem.


Typically that means that DX9 is not installed. The way to find out for sure is to run DxDiag on that PC.

Go to the Display tab (there may be more than 1, the first one is fine). There is a DDI field shown. That needs to be 7+ or the card/driver does not support D3D9.

If all of that looks fine you can try running the tests on that page and see what happens.
Stay Casual,KenDrunken Hyena</FON
achumack
achumack
try this

DWORD dx_version = 0;
GetDXVersion( &dx_version, NULL ); // function from dxutils
if( !dx_vers )
{
logWrite( "Cannot Identify DirectX version" );
return FALSE;
}

if( dx_vers <= 0x00090000 ) // DirectX 9.0
{
p_D3D = Direct3DCreate9( /*D3D_SDK_VERSION*/210 );
}
else if( dx_vers == 0x00090002 ) // DirectX 9.0b
{
p_D3D = Direct3DCreate9( D3D9b_SDK_VERSION );
}
else // DirectX 9.0c and later
{
p_D3D = Direct3DCreate9( D3D_SDK_VERSION );
}

Kekko
Kekko
Heh... Whatever it was, it'a gone now. The object is created just fine. It was probably a directX-version issue after all. Anyway, thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.