Skip to main content
gamedev.net
🔒 Locked

D3D9 Createfromfileex

Started by aker_jus 1 reply 550+ views
Original Post
aker_jus
aker_jus
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.
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions
aker_jus
aker_jus
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]
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions
Sharky
Sharky
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

Topic Locked

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

Sign in to reply to this topic.