Archived

This topic is now archived and is closed to further replies.

aker_jus

D3D9 Createfromfileex

Recommended Posts

I am transferring my texture manager from GL to D3D9 and I ran into a problem using the D3DXCreateTextureFromFileEx function. I do everything correct, but the returned Texture9 interface is not valid, so I cant use it. I retrieve everything from the file, width,height, format, using the 0 value (or D3DX_DEFAULT). What might the problem be? I am using a 24bit BMP. I will try to use jpeg too.

Share this post


Link to post
Share on other sites
No, jpeg isnt working either. The returned interface isnt valid.

but here is my code:

if (!D3DXCreateTextureFromFileEx(dev, tex.strFilename, 0, 0, 0, 0, D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT, D3DX_FILTER_LINEAR, bMipmapped? D3DX_FILTER_LINEAR : D3DX_FILTER_POINT,
0,NULL,NULL, &tex.pTexture))
return false;

sorry if it messed up by html.

[edited by - aker_jus on December 23, 2002 3:34:45 PM]

Share this post


Link to post
Share on other sites
You cannot test for a successful function call by using:

if(!D3DXCreateTextureFromFileEx....

This is because the function returns zero (D3D_OK == S_OK == 0x00000000L) if the function call is *successful*. So even if your function was succeeding you would always be returning false.

Try something like...

if(FAILED(D3DXCreateTextureFromFileEx...

This should hopefully work.

Regards,
Sharky

Share this post


Link to post
Share on other sites