Create texture failing

Started by
3 comments, last by DividedByZero 10 years, 3 months ago

Hi Guys,

This is probably a stupid one that is staring me in the face.

But, I am failing to create a texture from file

IDirect3DTexture9 *pTexture=NULL;
HRESULT error=D3DXCreateTextureFromFile(d3ddev,"sprite.png",&pTexture);

d3ddev is valid at this point because I can remove the above calls and the scene renders fine.

I have tried the sprite.png file in the same location of the exe file and even hard coded the file to be called from D:\sprite.png.

But, each time HRESULT returns D3DERR_INVALIDCALL

Any help on this would be absolutely awesome :)

Advertisement

When you tried "D:\sprite.png" did you actually have "D:\sprite.png" in the code? That might have failed because you need to use "D:\\sprite.png" instead for the backslash to work properly.

Thanks for the reply, but yes I am using the latter (D:\\sprite.png)
You should know to enable directx debug mode. Install directx sdk, run its config there is option for debug, break when directx error! Later there will be errors that hard to findout without debug mode help!
This post answer how to open debug mode: http://stackoverflow.com/questions/18613229/loading-textures-in-directx

You should know to enable directx debug mode. Install directx sdk, run its config there is option for debug, break when directx error! Later there will be errors that hard to findout without debug mode help!
This post answer how to open debug mode: http://stackoverflow.com/questions/18613229/loading-textures-in-directx

Actually, I just did that an hour ago. :)

I since found that I 'broke' the device creation during some late night coding. I somehow managed to set the backbuffer dimensions to zero.

Just goes to prove, once you have coded for so many hours straight the productivity curve starts going into the negative.

Thanks guys!

This topic is closed to new replies.

Advertisement